之前我用的是领域在我的 ubuntu VPS 服务器中。但目前,我不想使用领域在此服务器中。我只想使用IP地址在端口 80 上。我的服务器运行在 Ubuntu VPS 和 Nginx 上。我对Nginx。我不明白我应该在哪里更改配置文件。我的 Nginx 配置如下。有人能帮我更新配置文件吗?
upstream app_server {
server unix:/home/project_folder/run/gunicorn.sock fail_timeout=0;
}
server {
# add here the ip address of your server
# or a domain pointing to that ip (like example.com or www.example.com)
server_name domain.com www.domain.com;
keepalive_timeout 180;
client_max_body_size 4G;
proxy_connect_timeout 300s;
proxy_read_timeout 300s;
access_log /home/project_folder/logs/nginx-access.log;
error_log /home/project_folder/logs/nginx-error.log;
location /static/ {
alias /home/project_folder/static_in_env/static_root/;
}
location /media/ {
alias /home/project_folder/static_in_env/media_root/;
}
# checks for static file, if not found proxy to app
location / {
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.domain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = domain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name domain.com www.domain.com;
return 404; # managed by Certbot
}
感谢您宝贵的时间。