一、環境檢查
1、檢查nginx
ps -ef | grep "nginx"
顯示如下內容則代表nginx啟動正常
root 3285 1 0 12:57 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
2、檢查防火牆是否開啟
在其他機器上訪問服務器80端口,如果可以就代表防火牆已開啟。
二、PHP發布
1、修改nginx配置文件
vi nginx.conf
找到server修改類似如下內容
server {
listen 80;
server_name foo.com;
root /path;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ /.php$ {
try_files $uri =404;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
}
2、重啟狀態配置文件
/usr/local/nginx/sbin/nginx -s reload #不停止服務重讀配置文件
nginx + PHP7 + mysql 5.6
