我正在努力将我当前正在开发的网站放在我的服务器上。 当我尝试通过电缆使用常规互联网连接来访问它时,它工作正常。但是,当我尝试使用移动网络连接到我的域时,除了通过 Firefox 之外我无法访问它。错误主要有:“连接重置错误”/“网络错误”等
我尝试使用我的手机作为热点来进一步调查该问题,即使在我使用移动网络的计算机上,它也只能在 Firefox 上运行。 我的网站是使用 PHP 和 Symfony6 构建的。 我正在使用 nginx 作为我的网络服务器,这是我的配置:
server {
server_name domainname.xx www.domainname.xx XX.XX.XX.XX;
root path/to/public;
location ~ /.well-known {
allow all;
}
location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/var/run/php/php-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
#listen 80;
listen 443 ssl; # managed by Certbot
ssl_certificate /path/to/certificate/fullchain.pem; # managed by Certbot
ssl_certificate_key /path/to/certificate/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.domainname.xx) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = domainname.xx) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name domainname.xx www.domainname.xx XX.XX.XX.XX;
return 404; # managed by Certbot
}
感谢您为我提供的任何帮助。
如果有人遇到同样的问题,看来是我的 nginx 配置中未配置 IPv6...
我只需添加
listen [::]:80
和 listen [::]:443
,它就可以在移动网络上运行。