轉載自Ubuntu 14/16下的Laravel LNMP線上環境自動部署腳本php
說明
此腳本用於在一臺全新的 Ubuntu 14.04 LTS上部署適合 Laravel 使用的 LNMP 生產環境。
此腳本參照了 Homestead 環境設置腳本 ,並作了更加適用於生產環境的效率和安全調優。項目地址:https://github.com/summerblue/laravel-ubuntu-inithtml
wget https://raw.githubusercontent.com/summerblue/laravel-ubuntu-init/master/deploy.sh chmod +x deploy.sh
vi deploy.sh # Configure MYSQL_ROOT_PASSWORD="{{--Your Password--}}" MYSQL_NORMAL_USER="estuser" MYSQL_NORMAL_USER_PASSWORD="{{--Your Password--}}"
運行腳本
./deploy.sh
nginx
git clone
拉下項目到項目文件夾cd /data/www/{YOU PROJECT FOLDER NAME} chown www:www -R ./
server { listen 80; server_name {{---YOU-DOMAIN-NAME---}}; root "{{---YOU-PROJECT-FOLDER---}}"; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log /data/log/nginx/{{---YOU-PROJECT-NAME---}}-access.log; error_log /data/log/nginx/{{---YOU-PROJECT-NAME---}}-error.log error; sendfile off; client_max_body_size 100m; include fastcgi.conf; location ~ /\.ht { deny all; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
完成以後重啓Nginx
service nginx restart
laravel