Home >Backend Development >PHP Problem >How to deploy php project to nginx

How to deploy php project to nginx

藏色散人
藏色散人Original
2020-08-24 09:44:025086browse

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".

How to deploy php project to nginx

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn