include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
如圖所示:
同時說說,這裡php的解析雖然是用到了9000的端口,但這端口我們無須在iptables對外開放。9000是在這centos內部用來解析php的端口。
3、之後,通過:
systemctl start php-fpm
systemctl enable php-fpm
nginx -s reload
systemctl restart nginx
開啟nginx的php解析服務,同時設置這個服務開機啟動,並且重載nginx的配置文件,同時重啟nginx服務器。這上面的修改生效。
4、之後在配置文件指明的root目錄,我這沒改用默認的/usr/share/nginx/html,這個目錄中加個經典的1.php:
phpinfo();
?>
如下圖所示:
再用:
systemctl restart nginx
systemctl restart php-fpm
重啟下nginx和php,在windows的瀏覽器,輸入 http://你的網址或ip/1.php,發現能訪問則大功告成!
閱讀更多 程序員小新人學習 的文章