我知道这里有很多骗子,但是我似乎无法解决这个问题。
我正在关注有关使用Apache将Nginx设置为反向代理的文章。
我得到这个错误:
nginx: [emerg] "server" directive is not allowed here in
/etc/nginx/v.hosts/mydomain.com.conf:3
nginx: configuration file /etc/nginx/nginx.conf test failed
我的/etc/nginx/nginx.conf
样子是这样的:
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log main;
charset utf-8;
keepalive_timeout 65;
server_tokens off;
tcp_nopush on;
tcp_nodelay off;
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html index.htm;
}
}
include v.hosts/*.conf;
我/etc/nginx/v.hosts/mydomain.com.conf
看起来像这样:
server {
listen 80;
server_name mydomain.com;
access_log off;
error_log off;
location / {
proxy_pass http://127.0.0.1:81;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
}
}
线索和帮助将不胜感激:)
删除了所有链接,因为它们现在已失效。
—
斯文