搞砸了我的 Nginx 安装,情况变得更糟

搞砸了我的 Nginx 安装,情况变得更糟

有问题。尝试安装 Owncloud,但 Nginx 不起作用。按照说明操作,但我错过了一些东西,我只能来。这是我从 /etc/nginx/sites-enabled/defualt.conf 中得到的内容

server {
listen 8080 default_server;
listen [::]:8080 default_server;

# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;

root /var/www/html;

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;

这是 Nginx 状态

ginx.service - A high performance web server and a reverse proxy server
 Loaded: loaded(/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2018-09-01 10:25:44 PDT; 1h 31min ago
Docs: man:nginx(8)
Main PID: 21210 (nginx)
Tasks: 5 (limit: 4915)
CGroup: /system.slice/nginx.service
       ├─21210 nginx: master process        /usr/sbin/nginx -g daemon on; master_process on;
       ├─21211 nginx: worker process
       ├─21212 nginx: worker process
       ├─21213 nginx: worker process
       └─21214 nginx: worker process

Sep 01 10:25:44 Kodi-Server systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 01 10:25:44 Kodi-Server systemd[1]: Started A high performance web server and a reverse proxy server.

这是 nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

UFW 目前已禁用,无法查看还有什么问题。我遗漏了什么或可以提供什么?

答案1

我建议您编辑该行:

 index index.html index.htm index.nginx-debian.html;  

并只写出你的索引页的确切名称,例如 index.html; 。这是我管理自己的 Nginx 服务器的方式。

经过再三考虑,问题可能只是添加端口号“:8080”才能够通过外部地址(???.???.???.???:8080)访问网站。

我可能已经发现了问题,它刚刚发生在我身上。这可能与 ubuntu 防火墙有关,可以使用 sudo ufw disable 来停止它。这对我有用。

相关内容