首页 > 解决方案 > 我无法在我的 ubunutu 服务器上运行 nginx,我该如何解决?

问题描述

我正在尝试设置 ubuntu 服务器,我用“ sudo nginx -t”命令检查了 nginx,给出了这样的答案:

nginx: [emerg] invalid IPv6 address in "[192.168.0.28]:80" of the "listen" directive in /etc/nginx/sites-enabled/mfekz7g3anx7pvmz.onion:23
nginx: configuration file /etc/nginx/nginx.conf test failed

当我写“ service nginx start”时说 nginx.service 的作业失败,因为控制进程退出并出现错误代码。有关详细信息,请参阅“systemctl status nginx.service”和“journalctl -xe”。

当我写 systemctl status nginx.service

nginx.service - 高性能 Web 服务器和反向代理服务器已加载:已加载(/lib/systemd/system/nginx.service;已启用;供应商预设:已启用)活动:自 2019 年星期四以来失败(结果:退出代码)- 06-20 15:08:31 EEST;1 分钟 24 秒前 Docs: man:nginx(8) Process: 25213 ExecStart=/usr/sbin/nginx -g daemon on; master_process 开启;(code=exited, status=1/FAILU Process: 27339 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, statu

6 月 20 日 15:08:31 eysterty-VirtualBox systemd[1]:启动高性能 Web 服务器和反向专业版 6 月 20 日 15:08:31 eysterty-VirtualBox nginx[27339]:nginx:[emerg] 中的 IPv6 地址无效[192.168.0.28] Jun 20 15:08:31 eysterty-VirtualBox nginx[27339]:nginx:配置文件 /etc/nginx/nginx.conf 测试 f Jun 20 15:08:31 eysterty-VirtualBox systemd[1]:nginx .service:控制进程退出,代码=退出状态 6 月 20 日 15:08:31 eysterty-VirtualBox systemd [1]:nginx.service:失败,结果为“退出代码”。6 月 20 日 15:08:31 eysterty-VirtualBox systemd [1]:无法启动高性能Web服务器和reve

/etc/nginx/sites-enabled/onionadress 内部:

# 默认服务器配置 # server { listen 192.168.0.28:80 default_server; 听 [192.168.0.28]:80 default_server;

# SSL 配置 # # 监听 443 ssl default_server; # 听 [::]:443 ssl default_server; # # 注意:您应该为 SSL 流量禁用 gzip。# 请参阅:https : //bugs.debian.org/773332 # # 阅读 ssl_ciphers 以确保配置安全。# 请参阅:https ://bugs.debian.org/765782 # # 由 ssl-cert 包生成的自签名证书 # 不要在生产服务器中使用它们!# # 包括片段/snakeoil.conf;

根 /var/www/mfekz7g3anx7pvmz.onion/html;

# 如果您使用的是 PHP 索引 index.html index.htm index.nginx-debian.html,则将 index.php 添加到列表中;

server_name mfekz7g3anx7pvmz.onion;

location / { # 首先尝试将请求作为文件,然后 # 作为目录,然后返回显示 404。try_files $uri $uri/ =404; 允许 192.168.0.28;

}

# 将 PHP 脚本传递给 FastCGI 服务器 # #location ~ .php$ { # include snippets/fastcgi-php.conf; # # # 使用 php-fpm(或其他 unix 套接字): # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # # 使用 php-cgi(或其他 tcp 套接字): # fastcgi_pass 127.0.0.1:9000; #}

# 拒绝访问 .htaccess 文件,如果 Apache 的文档根目录 # 与 nginx 的一致 # #location ~ /.ht { #deny all; #} }

# example.com 的虚拟主机配置 # # 您可以将其移动到 sites-available/ 和 >symlink 下的不同文件中 # 到 sites-enabled/ 以启用它。# #server { # 监听 127.0.0.1:8080; # 听 [::]:80; # # server_name mfekz7g3anx7pvmz.onion; # # 根 /var/www/onion; # 索引 index.html; ##位置/{#try_files $uri $uri/ =404; # 允许 127.0.0.1; #全部拒绝;# } #}

标签: ubuntunginxservertor

解决方案


推荐阅读