centos7, nginx, php 环境配置

2019/09 01 16:09
    server {
        listen       80;
        server_name  xx.xx.cn;
        root         /data/xxx;
        index index.html index.htm index.php;
        location / {
            try_files $uri $uri/ /index.php$is_args$args;
        }
        location ~ \.php$ {
            try_files $uri =404;
            include fastcgi.conf;
            fastcgi_pass 127.0.0.1:9000;
        }
如果要独立配置多个域名,则:

vi /etc/nginx/nginx.conf

server {
   listen       80;
   server_name  xx1.xx.cn;
   root         /data/www;
}

server {
   listen       80;
   server_name  xx2.xx.cn;
   root         /data/www2;
}