Joke Collection Website - Blessing messages - How to deploy php projects on the server

How to deploy php projects on the server

First, Ali ECS server configuration

? 1. Because several sites are online, you need to configure ngnix multi-site.

? 2. Alibaba Cloud ecs directory structure, ngxin is in /etc/nginx/ directory, and the configuration place is mainly nginx.config file. Or create a new configuration file in conf.d and then create it in the file include to nginx.config

? 3.nginx.config Create new site information

Server {

Listen. 80;

server_name? www . your domain name.com;

The relative path of the root website;

Index index.php, index.html and index.htm;

# charset koi 8-r;

#access_log? /var/log/nginx/host.access.log? Mainly;

# Load the configuration file of the default server block.

Include /etc/nginx/default.d/*. conf

Location/{

# try _ files $ uri $ uri//index . PHP;

Root? /opt/www/PC web/ytyy _ PC;

Index? index.php· index.html· index.htm; If (! -e $ request file name) {? Rewrite? ^(.*)$ /index.php? s=$ 1? Finally; ? Break; }} url rewriting (optional)

# Redirect server error page to static page/40x.html.

#

error_page? 404 ? /404 . html; ? 40 Error page configuration

location = /40x.html {

}

# Redirect server error page to static page /50x.html

#

error_page? 500 502 503 504 ? /50x . html; ? 50 wrong page configuration

location = /50x.html {

}

Location ~ \. php$ {

Root? Site relative path;

fastcgi_pass? 127.0.0. 1:9000;

fastcgi_index? index.php;

fastcgi_param? Script _ file name? $ document _ root $ fastcgi _ script _ name;

Include fastcgi params.

}

Location ~/\. ht {

Deny? All;

}

}

The basic content of the configuration file is as above;

After configuration, test whether the configuration file is correct.

This configuration is ready for use.

Then restart the nginx server?

So nginx configuration is finished, and it can be used. Put the site file in the corresponding directory. I went straight to git clone.

2.thinkphp project file transfer

I thought it was over after uploading. The first problem encountered when uploading is an error in accessing the page, which was hijacked by the 1 14 page of Telecom. . . Martin can't see the mistake.

Universal Baidu Dafa

Solution 1.internet advanced options->; Privacy->; Site? Newly added blocking site

Solution 2: Control Panel-> Network and Internet-> Local connection-> Attribute-> ipv4? Use the following ip

Finally, you can see the error page. . . . . . Hemp eggs. Open the Universal Baidu Solution again.

?

?

? The final conclusion is caused by file directory permissions. Thinkphp's runtime directory does not have write permission. . It seems that all thinkphp files uploaded to Ali have this problem. Solving the problem is simple.

Enter the project file directory.

Files with the highest authority directly.

Chmod-R 777[ directory]? //linux modify file permissions

?