1.在home/wwwroot/zhongjie 新建zhongjie文件夹
2.在usr/local/nginx/conf/vhost/zhongjie.conf 新建配置文件zhongjie.conf配置文件
代码如下
server { listen 99; #1.访问端口 #listen [::]:80; server_name _; index index.html index.htm index.php default.html default.htm default.php; root /home/wwwroot/zhongjie; # 2.指向目录 include other.conf; #error_page 404 /404.html; # Deny access to PHP files in specific directory #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } include enable-php.conf; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ /.well-known { allow all; } location ~ /\. { deny all; } access_log /home/wwwlogs/zhongjie.log; #3.生成日志文件 }
(此代码参考lnmp默认的nginx.conf)
然后重启服务器
nginx -s reload :修改配置后重新加载生效
时间: 2024-11-18 21:25:30