一,安裝Nginx
apt-get install nginx
1,配置nginx
nginx所有的配置在 /etc/nginx/nginx.conf中
nginx.conf配置裡面包括了
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
這兩個配置,是以這裡面的配置也是有效的。
錯誤日志 error_log /var/log/nginx/error.log;
這裡我們把配置寫在 /etc/nginx/sites-available/default中
修改 root /usr/share/nginx/html; 這是網頁的根目錄,預設裡面有一個index.html頁面
index index.html index.htm修改成index index.php index.html index.htm;
增加
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
2,儲存檔案,使配置生效 /etc/init.d/nginx reload
3,啟動nginx
/etc/init.d/nginx start
4,在 /usr/share/nginx/html下建立index.php
<? php
phpinfo();
?>
二 安裝php
QQ:519841366
本頁版權歸作者和部落格園所有,歡迎轉載,但未經作者同意必須保留此段聲明,
且在文章頁面明顯位置給出原文連結,否則保留追究法律責任的權利