我正在尝试重新配置Nginx安装,以代理到本地虚幻安装.
我得到的错误是-
Nginx -t -c /etc/Nginx/sites-available/ghost
Nginx: [emerg] "server" directive is not allowed here in /etc/Nginx/sites-available/ghost:1
Nginx: configuration file /etc/Nginx/sites-available/ghost test Failed
这是我的配置
server {
listen 80;
server_name domainnamehere.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
server_name www.nonstopdev.com;
access_log /var/log/Nginx/domainnamehere.com.access.log;
error_log /var/log/Nginx/domainnamehere.com.error.log;
ssl on;
ssl_certificate /etc/letsencrypt/live/domainnamehere.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domainnamehere.com/privkey.pem;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2368;
}
}
以下配置工作正常,没有任何问题-
server {
listen 80;
server_name mydomainname.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2368;
}
}
最佳答案