我正致力于创建一个基本的Nginx服务器以显示静态HTML网页(暂时),我在查看我的内容时遇到了问题。我已经按照教程here创建了一个名为quake.dev
的新服务器块。我已将符号链接移至default
中的/etc/sites-enabled/default
服务器块,并为sites-enabled
sites-available
和quake.dev
之间的符号链接
我的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; # 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_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
quake.dev
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/quake.dev/html/;
# Add index.php to the list if you are using PHP
index index.html index.htm;
server_name quake.dev www.quake.dev;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
allow 192.168.0.1/24;
allow 127.0.0.1;
deny all;
}
}
然后我将quake.dev
添加到我的/etc/hosts
文件中:
主机
#127.0.0.1 localhost
127.0.0.1 quake.dev
127.0.1.1 wintermute
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
重新启动nginx和网络服务后,我将quake.dev
加载到Chrome中,然后返回ERR_CONNECTION_REFUSED
。有什么人能想到的吗?我好几天来一直在这个问题上下。
答案 0 :(得分:0)
更新:事实证明,启用网站和网站可用之间的符号链接已损坏。 将头戴帽子放在头上