1.新建.conf文件
sudo touch caomall17.conf
2.编辑文件
sudo gedit ./caomall17.conf
server
{
listen 80;
#listen [::]:80 default_server ipv6only=on;
server_name local.jujiang.caomall.net;
index index.html index.htm index.php;
root /home/wwwroot/default/jujiang/Public;
#error_page 404 /404.html;
include enable-php-pathinfo.conf;
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/access.log;
}
server_name 为要解析的域名
root 为项目的主入口路径
- 重启服务器
sudo nginx -s stop
sudo nginx
- OK
5.下期分享一下nginx 反代理 强制https
网友评论