How to deploy php project to nginx: first install "Nginx" and "php-fpm"; then copy the project to the "nginx/html" file; then modify the configuration file; finally reload Nginx and Just start "php-fpm".
Recommended: "PHP Video Tutorial"
Using Nginx to deploy PHP projects in Linux environment
1. Install Nginx and php-fpm
2. Deploy the project
①Copy your project to this file
cd /usr/ local/nginx/html
②Modify the configuration file
cd ../ cd conf vim nginx.conf # 在location / {........}模块的index配置中添加index.php #location ~ \.php$ {.......} 把该模式块的注释全部去掉,并将fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 改为 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
③Reload Nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf /usr/local/nginx/sbin/nginx -s reload
④Start php-fpm
/usr/local/php/sbin/php-fpm
⑤Access your project
The above is the detailed content of How to deploy php project to nginx. For more information, please follow other related articles on the PHP Chinese website!