gpt4 book ai didi

ubuntu - Nginx 配置文件更新问题

转载 作者:行者123 更新时间:2023-12-04 19:27:24 31 4
gpt4 key购买 nike

以前我在我的 中使用域Ubuntu VPS服务器。但目前,我不想使用 域名 SSL 在这台服务器上。我想使用 访问此服务器仅端口 80 中的 IP 地址 .我的服务器在 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
}
感谢您的宝贵时间。

最佳答案

请将这两行更改为 server_name domain.com www.domain.com;server_name Your IP Address; .

关于ubuntu - Nginx 配置文件更新问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69784738/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com