Nginx 无法启动或重新启动,并给出错误:“nginx:[emerg]“location”指令在 /home/admin/conf/web/nginx.conf:100 中不允许使用”。
我明白这是因为位置部分不在 { } 标签内,但是这个帐户的配置文件非常大,我不知道如何解决这个问题。
旧代码占用了太多空间,无法发布。
谢谢你的帮助!
更新的配置:
server {
listen 192.168.0.39:80;
server_name test-page.ga www.test-page.ga;
error_log /var/log/apache2/domains/test-page.ga.error.log error;
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/test-page.ga/public_html;
access_log /var/log/apache2/domains/test-page.ga.log combined;
access_log /var/log/apache2/domains/test-page.ga.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/test-page.ga/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.test-page.ga.conf*;
}
server {
listen 192.168.0.39:80;
server_name mailmyserver.ga www.mailmyserver.ga;
error_log /var/log/apache2/domains/mailmyserver.ga.error.log error;
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/mailmyserver.ga/public_html;
access_log /var/log/apache2/domains/mailmyserver.ga.log combined;
access_log /var/log/apache2/domains/mailmyserver.ga.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/mailmyserver.ga/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.mailmyserver.ga.conf*;
}
server {
listen 192.168.0.39:80;
server_name globalcdg.ga www.globalcdg.ga;
error_log /var/log/apache2/domains/globalcdg.ga.error.log error;
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/globalcdg.ga/public_html;
access_log /var/log/apache2/domains/globalcdg.ga.log combined;
access_log /var/log/apache2/domains/globalcdg.ga.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/globalcdg.ga/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.globalcdg.ga.conf*;
}
server {
listen 192.168.0.39:80;
server_name lifepost.site www.lifepost.site;
error_log /var/log/apache2/domains/lifepost.site.error.log error;
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/lifepost.site/public_html;
access_log /var/log/apache2/domains/lifepost.site.log combined;
access_log /var/log/apache2/domains/lifepost.site.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/lifepost.site/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.lifepost.site.conf*;
}
server {
listen 192.168.0.39:80;
server_name cdgmediagroup.com www1.cdgmediagroup.com www.cdgmediagroup.com;
error_log /var/log/apache2/domains/cdgmediagroup.com.error.log error;
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/cdgmediagroup.com/public_html;
access_log /var/log/apache2/domains/cdgmediagroup.com.log combined;
access_log /var/log/apache2/domains/cdgmediagroup.com.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/cdgmediagroup.com/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.cdgmediagroup.com.conf*;
}
server {
listen 192.168.0.39:80;
server_name cartergames.ga www.cartergames.ga;
error_log /var/log/apache2/domains/cartergames.ga.error.log error;
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/cartergames.ga/public_html;
access_log /var/log/apache2/domains/cartergames.ga.log combined;
access_log /var/log/apache2/domains/cartergames.ga.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/cartergames.ga/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.cartergames.ga.conf*;
}
server {
listen 192.168.0.39:80;
server_name oregondate.space www.oregondate.space;
error_log /var/log/apache2/domains/oregondate.space.error.log error;
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/oregondate.space/public_html;
access_log /var/log/apache2/domains/oregondate.space.log combined;
access_log /var/log/apache2/domains/oregondate.space.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/oregondate.space/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.oregondate.space.conf*;
}
server {
listen 192.168.0.39:80;
server_name testdummies.cf www.testdummies.cf;
error_log /var/log/apache2/domains/testdummies.cf.error.log error;
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/testdummies.cf/public_html;
access_log /var/log/apache2/domains/testdummies.cf.log combined;
access_log /var/log/apache2/domains/testdummies.cf.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/testdummies.cf/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.testdummies.cf.conf*;
}
server {
listen 192.168.0.39:80;
server_name cdg.tech www.cdg.tech;
error_log /var/log/apache2/domains/cdg.tech.error.log error;
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/cdg.tech/public_html;
access_log /var/log/apache2/domains/cdg.tech.log combined;
access_log /var/log/apache2/domains/cdg.tech.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/cdg.tech/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.cdg.tech.conf*;
}
server {
listen 192.168.0.39:80;
server_name complexwebs.com www1.complexwebs.com www.complexwebs.com;
error_log /var/log/apache2/domains/complexwebs.com.error.log error;
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/complexwebs.com/public_html;
access_log /var/log/apache2/domains/complexwebs.com.log combined;
access_log /var/log/apache2/domains/complexwebs.com.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/complexwebs.com/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.complexwebs.com.conf*;
}
server {
listen 192.168.0.39:80;
server_name cdghost.xyz www.cdghost.xyz cdghost-xyz.beta.cdg.tech;
error_log /var/log/apache2/domains/cdghost.xyz.error.log error;
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/cdghost.xyz/public_html;
access_log /var/log/apache2/domains/cdghost.xyz.log combined;
access_log /var/log/apache2/domains/cdghost.xyz.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/cdghost.xyz/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.cdghost.xyz.conf*;
}
server {
listen 192.168.0.39:80;
server_name srv39.cdghost.xyz www.srv39.cdghost.xyz srv39-cdghost-xyz.srv39.cdghost.xyz;
error_log /var/log/apache2/domains/srv39.cdghost.xyz.error.log error;
location /.well-known/acme-challenge {
alias /etc/letsencrypt/.well-known/acme-challenge;
location ~ /.well-known/acme-challenge/(.*) {
add_header Content-Type text/plain;
}
}
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/srv39.cdghost.xyz/public_html;
access_log /var/log/apache2/domains/srv39.cdghost.xyz.log combined;
access_log /var/log/apache2/domains/srv39.cdghost.xyz.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/srv39.cdghost.xyz/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.srv39.cdghost.xyz.conf*;
}
server {
listen 192.168.0.39:80;
server_name mlinks.ml www.mlinks.ml mlinks-ml.srv39.cdghost.xyz;
error_log /var/log/apache2/domains/mlinks.ml.error.log error;
location /.well-known/acme-challenge {
alias /etc/letsencrypt/.well-known/acme-challenge;
location ~ /.well-known/acme-challenge/(.*) {
add_header Content-Type text/plain;
}
}
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/mlinks.ml/public_html;
access_log /var/log/apache2/domains/mlinks.ml.log combined;
access_log /var/log/apache2/domains/mlinks.ml.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/mlinks.ml/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.mlinks.ml.conf*;
}
server {
listen 192.168.0.39:80;
server_name zearch.ga www.zearch.ga zearch-ga.srv39.cdghost.xyz;
error_log /var/log/apache2/domains/zearch.ga.error.log error;
location /.well-known/acme-challenge {
alias /etc/letsencrypt/.well-known/acme-challenge;
location ~ /.well-known/acme-challenge/(.*) {
add_header Content-Type text/plain;
}
}
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/zearch.ga/public_html;
access_log /var/log/apache2/domains/zearch.ga.log combined;
access_log /var/log/apache2/domains/zearch.ga.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/zearch.ga/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.zearch.ga.conf*;
}
server {
listen 192.168.0.39:80;
server_name getlifepost.cu.cc www.getlifepost.cu.cc getlifepost-cu-cc.srv39.cdghost.xyz;
error_log /var/log/apache2/domains/getlifepost.cu.cc.error.log error;
location /.well-known/acme-challenge {
alias /etc/letsencrypt/.well-known/acme-challenge;
location ~ /.well-known/acme-challenge/(.*) {
add_header Content-Type text/plain;
}
}
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/getlifepost.cu.cc/public_html;
access_log /var/log/apache2/domains/getlifepost.cu.cc.log combined;
access_log /var/log/apache2/domains/getlifepost.cu.cc.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/getlifepost.cu.cc/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.getlifepost.cu.cc.conf*;
}
server {
listen 192.168.0.39:80;
server_name truos.ga www.truos.ga truos-ga.srv39.cdghost.xyz;
error_log /var/log/apache2/domains/truos.ga.error.log error;
location /.well-known/acme-challenge {
alias /etc/letsencrypt/.well-known/acme-challenge;
location ~ /.well-known/acme-challenge/(.*) {
add_header Content-Type text/plain;
}
}
location / {
proxy_pass http://192.168.0.39:8080;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/truos.ga/public_html;
access_log /var/log/apache2/domains/truos.ga.log combined;
access_log /var/log/apache2/domains/truos.ga.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/truos.ga/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.truos.ga.conf*;
}
答案1
出现问题的原因在于您没有使用正确的缩进,并且没有将服务器块分离到单独的文件中,以便您可以启用和禁用配置进行测试。
无论如何,nginx 实际上会准确地告诉您问题出在哪里。nginx: [emerg] "location" directive is not allowed here in /home/admin/conf/web/nginx.conf:100
该:100
部分位于第 100 行。如果您检查文件的第 100 行,您将看到您有以下块。
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.globalcdg.ga.conf*;
} # <---- You're closing the server block here.
# Looks like you're missing the opening server block here.
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mp4|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/admin/web/lifepost.site/public_html;
access_log /var/log/apache2/domains/lifepost.site.log combined;
access_log /var/log/apache2/domains/lifepost.site.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/admin/web/lifepost.site/document_errors/;
}
location @fallback {
proxy_pass http://192.168.0.39:8080;
}
location ~ /\.ht {return 404;}
location ~ /\.svn/ {return 404;}
location ~ /\.git/ {return 404;}
location ~ /\.hg/ {return 404;}
location ~ /\.bzr/ {return 404;}
include /home/admin/conf/web/nginx.lifepost.site.conf*;
} # <--- this ends the partial server block.