Get the App
SLTechnology News&Howtos  ›  Development  › 

How nginx deploys php7 projects

Shulou Source: shulou.com Published: 2022-06-02 07:29:59 10月09日 Update

This article mainly explains "how nginx deploys php7 projects". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deeper to study and learn "how nginx deploys php7 projects" together!

Nginx deployment php7 project methods: 1, install nginx and php7 through install;2, copy laravel project to the specified directory and modify the configuration document;3, restart nginx can be.

Operating environment: centos 7.4 system, PHP 7.0 version, Dell G3 computer.

How does nginx deploy php7 projects?

7 simple steps to build nginx+php7 environment and deploy laravel project

Build nginx+php7 environment laravel project deployment

0. preparations

1, host, mine is centos7.4

2. Write a laravel project

3. Update yum warehouse

[root@piehost ~]# yum install https://centos7.iuscommunity.org/ius-release.rpm -y

1. install Nginx

[root@piehost ~]# yum -y install nginx && systemctl start nginx && systemctl enable nginx

2. install the database

3. Install php7

[root@piehost ~]# yum install -y php70u-fpm && yum install php70u-gd php70u-mysqlnd php70u-pdo php70u-mcrypt php70u-mbstring php70u-json -y && systemctl start php-fpm && systemctl enable php-fpm

4. After setting up the environment, copy the laravel project to the specified directory and modify the configuration document

Assuming your laravel project is called mylaravel project, copy it to/root /soft/www

[root@piehost ~]# vim /etc/nginx/conf.d/mylaravelproject.conf //modify configuration file server {listen 80;server_name Your server IP address or domain name;root /soft/www/mylaravelproject/public;index index.php index.html;location / { try_files $uri $uri/ /index.php?$ query_string; client_max_body_size 1000m;}location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}

5. restart nginx

[root@piehost ~]# systemctl restart nginx

6. Go to your project directory to modify permissions

Modify permissions for these two folders: bootstrap storage

[root@piehost mylaravelproject]# chmod 777 -R bootstrap storage

7. Open port 80

[root@piehost mylaravelproject]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT

You can now access your website from your address.

Thank you for reading, the above is the content of "how nginx deploys php7 project", after learning this article, I believe that everyone has a deeper understanding of how nginx deploys php7 project, and the specific use needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Tags: Project environment directory project copy document learning configuration content address permission two host warehouse can pass domain name that is ideas situations data Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Xiaomi Redmi macOS OPPO Reno