这是我的ngnix.conf。
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
server {
listen 8080;
server_name localhost;
index index.html index.htm index.php;
root /var/www/html;
}
在编辑文件后输入命令。
service nginx restart
nginx.service的作业失败。请参阅&system;系统状态nginx.service'和' journalctl -xn'详情。
systemctl -l status nginx.service
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code) since Wed 2015-09-16 15:31:14 HKT; 5s ago
Sep 16 15:31:14 pengsir nginx[6133]: nginx: configuration file
/etc/nginx/nginx.conf test failed
我已经解决了问题,仍然存在新问题。
nginx -t
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:8080, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@pengsir:/home/debian8# service nginx start
Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.
root@pengsir:/home/debian8# systemctl -l status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code) since Wed 2015-09-16 17:37:54 HKT; 21s ago
Process: 6030 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 9636 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Process: 9634 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 5908 (code=exited, status=0/SUCCESS)
Sep 16 17:37:51 pengsir nginx[9636]: nginx: [warn] conflicting server name "localhost" on 0.0.0.0:8080, ignored
Sep 16 17:37:51 pengsir nginx[9636]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
Sep 16 17:37:52 pengsir nginx[9636]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
Sep 16 17:37:52 pengsir nginx[9636]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
Sep 16 17:37:53 pengsir nginx[9636]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
Sep 16 17:37:53 pengsir nginx[9636]: nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
Sep 16 17:37:54 pengsir nginx[9636]: nginx: [emerg] still could not bind()
Sep 16 17:37:54 pengsir systemd[1]: nginx.service: control process exited, code=exited status=1
Sep 16 17:37:54 pengsir systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Sep 16 17:37:54 pengsir systemd[1]: Unit nginx.service entered failed state.
答案 0 :(得分:0)
您可以看到绑定8080。您需要从站点中删除绑定8080。 删除后,重新启动服务
答案 1 :(得分:0)
您还有另一个进程正在监听端口80,在本例中为httpd。您需要先停止该服务(可能要在启动时将其禁用)。
要停止Apache;
y <- gsub( "[.]", "", "7k")
scales::dollar( as.numeric( gsub( "k", "000", y) ) )
要停止在启动时启动Apache;
systemctl stop httpd
和
systemctl disable httpd
演示
答案 2 :(得分:0)
if (apache 和 nginx) 两者
您要启用 Angnix 吗?
1-systemctl 停止 httpd
2-service nginx 重启
3-service nginx 状态