如何解决除私有IP之外,无法访问Nginx Web服务器
抱歉,已经问了一百万遍了,但是我在任何地方都找不到答案!
我正在尝试在运行ubuntu服务器20.04的计算机上托管一个wordpress网站,并且正在使用Nginx作为Web服务器。到目前为止,我已经成功地使用专用IP地址192.168.0.16在我的浏览器上建立了wordpress网站:
但是,当我尝试使用在123-reg.co.uk上购买的实际域名时,不会返回任何内容。在123-reg.co.uk DNS管理页面中,我建立了两个A记录
DNS ENTRY TYPE PRIORITY TTL DESTINATION/TARGET
* A <my public ip>
@ A <my public ip>
我只使用了两个123-reg名称服务器:
ns.123-reg.co.uk
ns2.123-reg.co.uk
这是我的/ etc / nginx / sites-available /文件:
server {
listen 80;
server_name www.<my domain name> <my domain name>;
root /var/www/wordpress/public;
index index.php;
access_log /var/www/wordpress/logs/access.log;
error_log /var/www/wordpress/logs/error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
我的/etc/nginx/nginx.conf文件:
user www-data;
worker_processes auto;
#pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3,ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
我猜我在某处缺少一个步骤,但是我对这些东西没有经验。 任何帮助将不胜感激,我完全陷于下一步该做什么!
西蒙
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。