# 安裝 nginx
sudo apt-get install nginx
sudo service nginx start
# 安裝 php5
sudo apt-get update
sudo service php5-fpm restart
# 安裝 php7
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.0 php7.0-fpm
service php7.0-fpm restart
# nginx 設定
請在 /etc/nginx/sites-available 設定你的站
如要用 php5
就在 server { ... } 裡加上
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
如要用 php7
就在 server { ... } 裡加上
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
留言列表