站点服务单独的配置文件;一般不会把所有站点服务全部配置到nginx.conf下,会将每个站点服务配置一个单独的配置文件(*.conf)。
nginx.conf是整个nginx全局下的配置,在全局配置下引入单独站点的配置文件,如:
1 2 3
|
include /www/server/panel/vhost/nginx/*.conf;
|
配置时候注意层级
权限全是600(rw——-)
.conf文件示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| server { listen 80; server_name rms.luojing.top; index index.php index.html index.htm default.php default.htm default.html; root /www/wwwroot/rms.luojing.top;
include enable-php-56.conf;
include /www/server/panel/vhost/rewrite/rms.luojing.top.conf;
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md) { return 404; }
location ~ ^/.well-known/{ allow all; }
if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) { return 403; }
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; error_log /dev/null; access_log /dev/null; }
location ~ .*\.(js|css)?$ { expires 12h; error_log /dev/null; access_log /dev/null; } location / { try_files $uri $uri/ /index.html; } access_log /www/wwwlogs/rms.luojing.top.log; error_log /www/wwwlogs/rms.luojing.top.error.log; }
|