nginx配置静态页访问
server {
server_name static.naice.me; // 你的域名或者 ip # 域名:static.naice.me 这里用 “_” 代表获取匹配所有
root /www/static-web/static-web; // 你的克隆到的项目路径
index index.html; // 显示首页
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|js|pdf|txt){
root /www/static-web/static-web;
} // 静态文件访问
}
server {
listen 6667;
#server_name _;
server_name localhost;
root ‘/data/web/websvn/css-task/css task3’;
index magicMirror.html;
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|js|pdf|txt){
root ‘/data/web/websvn/css-task/css task3’;
}
}
sudo nginx -s reload
error:
nginx: [error] open() “/usr/local/nginx/logs/nginx.pid” failed (2: No such file or directory)
解决:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
./nginx -s reload