背景:thinkphp5项目

服务器环境: lnmp

 

1 打开路径  /usr/local/nginx/conf/vhost/

   此路径下会有你添加的域名文件夹。。找到对应的域名打开。

 

2  代码如下,背景色部分是我新加的

server
    {
        listen 80;
        #listen [::]:80;
        server_name www.xxx.cn xxx.cn;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/www.xxx.cn/public;

        include other.conf;
        #error_page   404   /404.html;
        include enable-php.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location / {
          if (!-e $request_filename) {
                rewrite ^(.*)$ /index.php?s=$1 last;
                break;
          }
       }
    
        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/www.xxx.cn.log;
    }

 

3 重启nginx 

#nginx命令 
  
start: 
/usr/local/nginx/sbin/nginx 
 
stop: 
/usr/local/nginx/sbin/nginx -s stop 
 
reload: 
/usr/local/nginx/sbin/nginx -s reload 
 

 

相关文章:

  • 2021-06-24
  • 2021-10-22
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
猜你喜欢
  • 2021-09-08
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
相关资源
相似解决方案