日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux系统nginx启动不了,nginx启动不了,求大神帮助!

發布時間:2025/3/11 linux 44 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux系统nginx启动不了,nginx启动不了,求大神帮助! 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

服務器掛了,折騰半天Nginx都起不來,不知道咋回事,本人小白用戶,求大神幫幫忙!

# nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

# service nginx start

Starting nginx (via systemctl): Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

[FAILED]

# systemctl status nginx

● nginx.service

Loaded: loaded (/usr/lib/systemd/system/nginx.service; bad; vendor preset: disabled)

Active: failed (Result: exit-code) since Wed 2017-06-07 09:22:37 CST; 22s ago

Process: 20047 ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)

Jun 07 09:22:37 iZ28qwahedc systemd[1]: Starting nginx.service...

Jun 07 09:22:37 iZ28qwahedc nginx[20047]: nginx: [emerg] open() "/etc/nginx...)

Jun 07 09:22:37 iZ28qwahedc nginx[20047]: nginx: configuration file /etc/ng...d

Jun 07 09:22:37 iZ28qwahedc systemd[1]: nginx.service: control process exit...1

Jun 07 09:22:37 iZ28qwahedc systemd[1]: Failed to start nginx.service.

Jun 07 09:22:37 iZ28qwahedc systemd[1]: Unit nginx.service entered failed s....

Jun 07 09:22:37 iZ28qwahedc systemd[1]: nginx.service failed.

Hint: Some lines were ellipsized, use -l to show in full.

# /usr/local/nginx/sbin/nginx -t -c /etc/nginx/nginx.conf

nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

nginx: configuration file /etc/nginx/nginx.conf test failed

# journalctl -xe

-- The start-up result is done.

Jun 07 09:38:01 iZ28qwahedc systemd[1]: Starting Session 1059 of user root.

-- Subject: Unit session-1059.scope has begun start-up

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit session-1059.scope has begun starting up.

Jun 07 09:38:01 iZ28qwahedc CROND[20610]: (root) CMD (/root/php.sh)

Jun 07 09:39:01 iZ28qwahedc systemd[1]: Started Session 1060 of user root.

-- Subject: Unit session-1060.scope has finished start-up

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit session-1060.scope has finished starting up.

--

-- The start-up result is done.

Jun 07 09:39:01 iZ28qwahedc systemd[1]: Starting Session 1060 of user root.

-- Subject: Unit session-1060.scope has begun start-up

-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

--

-- Unit session-1060.scope has begun starting up.

Jun 07 09:39:01 iZ28qwahedc CROND[20619]: (root) CMD (/root/php.sh)

/usr/local/nginx/conf/nginx.conf里的配置

user www www;

worker_processes auto;

error_log /data/wwwlogs/error_nginx.log crit;

pid /var/run/nginx.pid;

worker_rlimit_nofile 65535;

events {

use epoll;

worker_connections 8896;

multi_accept on;

}

http {

include mime.types;

default_type application/octet-stream;

server_names_hash_bucket_size 128;

client_header_buffer_size 32k;

large_client_header_buffers 4 32k;

client_max_body_size 20m;

sendfile on;

tcp_nopush on;

keepalive_timeout 600;

server_tokens on;

tcp_nodelay on;

fastcgi_connect_timeout 300;

fastcgi_send_timeout 1000;

fastcgi_read_timeout 1000;

fastcgi_buffer_size 1024k;

fastcgi_buffers 8 1024k;

fastcgi_busy_buffers_size 1024k;

fastcgi_temp_file_write_size 1024k;

#Gzip Compression

gzip on;

gzip_buffers 16 8k;

gzip_comp_level 6;

gzip_http_version 1.1;

gzip_min_length 256;

gzip_proxied any;

gzip_vary on;

gzip_types

text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml

text/javascript application/javascript application/x-javascript

text/x-json application/json application/x-web-app-manifest+json

text/css text/plain text/x-component

font/opentype application/x-font-ttf application/vnd.ms-fontobject

image/x-icon;

gzip_disable "MSIE [1-6]\.(?!.*SV1)";

#If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.

open_file_cache max=1000 inactive=20s;

open_file_cache_valid 30s;

open_file_cache_min_uses 2;

open_file_cache_errors on;

upstream php_fpm_sock{

server unix:/dev/shm/php-fpm.socket;

server unix:/dev/shm/php-fpm-b.socket;

server unix:/dev/shm/php-fpm-c.socket;

}

fastcgi_next_upstream error timeout invalid_header http_503 http_500;

######################## default ############################

server {

listen 8080;

server_name www.yuming.com yuming.com 115.22.106.133;

#rewrite ^/(.*)$ http://www.yuming.com/$1 permanent;

access_log /data/wwwlogs/access_nginx.log combined;

root /data/wwwroot/www.yuming.com;

index index.html index.htm index.php;

location /nginx_status {

stub_status on;

access_log off;

allow 127.0.0.1;

deny all;

}

location ~ [^/]\.php(/|$) {

try_files $uri =404;

#fastcgi_pass remote_php_ip:9000;

fastcgi_pass unix:/dev/shm/php-cgi.sock;

#fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

include fastcgi.conf;

#server里面fastcgi_pass配置 https://segmentfault.com/q/1010000003707164

#include fastcgi_params;

#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {

expires 30d;

access_log off;

}

location ~ .*\.(js|css)?$ {

expires 7d;

access_log off;

}

}

########################## vhost #############################

include vhost/*.conf;

}

/usr/local/nginx/conf/vhost/www.yuming.com.conf的配置

server {

listen 80;

server_name www.yuming.com yuming.com 115.22.106.133;

if ($host != 'www.yuming.com') {

rewrite ^/(.*)$ http://www.yuming.com/$1 permanent;

}

access_log /data/wwwlogs/www.yuming.com_nginx.log combined;

index index.html index.htm index.php;

include /usr/local/nginx/conf/rewrite/wordpress.conf;

include /usr/local/nginx/conf/rocket-nginx.conf;

root /data/wwwroot/www.yuming.com;

location ~ [^/]\.php(/|$) {

#fastcgi_pass remote_php_ip:9000;

fastcgi_pass unix:/dev/shm/php-cgi.sock;

fastcgi_index index.php;

include fastcgi.conf;

}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {

expires 30d;

access_log off;

}

location ~ .*\.(js|css)?$ {

expires 7d;

access_log off;

}

}

/usr/local/nginx/logs/error.log錯誤

2017/06/06 21:08:00 [emerg] 6174#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

2017/06/07 08:30:32 [emerg] 18497#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

2017/06/07 08:56:29 [emerg] 19210#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

2017/06/07 09:01:33 [emerg] 19358#0: "fastcgi_pass" directive is duplicate in /usr/local/nginx/conf/nginx.conf:90

2017/06/07 09:14:52 [emerg] 19758#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

2017/06/07 09:22:37 [emerg] 20047#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

2017/06/07 09:23:32 [emerg] 20089#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

2017/06/07 09:26:56 [emerg] 20257#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

/usr/local/php/etc/php-fpm.conf配置

[global]

pid = run/php-fpm.pid

error_log = log/php-fpm.log

log_level = warning

emergency_restart_threshold = 60

emergency_restart_interval = 60s

process_control_timeout = 5s

daemonize = yes

;;;;;;;;;;;;;;;;;;;;

; Pool Definitions ;

;;;;;;;;;;;;;;;;;;;;

[www]

;listen string設置接受 FastCGI 請求的地址。可用格式為:'ip:port','port','/path/to/unix/socket'。每個進程池都需要設置。

listen = /dev/shm/php-cgi.sock

;listen.backlog int設置 listen(2) 的半連接隊列長度。“-1”表示無限制。默認值:-1。

listen.backlog = -1

;listen.allowed_clients string設置允許連接到 FastCGI 的服務器 IPV4 地址。等同于 PHP FastCGI (5.2.2+) 中的 FCGI_WEB_SERVER_ADDRS 環境變量。僅對 TCP 監聽起作用。每個地址是用逗號分隔,如果沒有設置或者為空,則允許任何服務器請求連接。默認值:any。

listen.allowed_clients = 127.0.0.1

;listen.owner string如果使用,表示設置 Unix 套接字的權限。在Linux中,讀寫權限必須設置,以便用于 WEB 服務器連接。在很多 BSD 派生的系統中可以忽略權限允許自由連接。默認值:運行所使用的用戶和組,權限為 0666。

;listen.owner = www

;listen.group = www

;listen.mode = 0666

;user = www

;group = www

listen.owner = www

listen.group = www

listen.mode = 0660

user = www

group = www

;pm string

;設置進程管理器如何管理子進程。可用值:static,ondemand,dynamic。必須設置。

;static - 子進程的數量是固定的(pm.max_children)。

;ondemand - 進程在有需求時才產生(當請求時,與 dynamic 相反,pm.start_servers 在服務啟動時即啟動。

;dynamic - 子進程的數量在下面配置的基礎上動態設置:pm.max_children,pm.start_servers,pm.min_spare_servers,pm.max_spare_servers。

pm = dynamic

;pm.max_children int pm 設置為 static 時表示創建的子進程的數量,pm 設置為 dynamic 時表示最大可創建的子進程的數量。必須設置。

;該選項設置可以同時提供服務的請求數限制。類似 Apache 的 mpm_prefork 中 MaxClients 的設置和 普通PHP FastCGI中的 PHP_FCGI_CHILDREN 環境變量。

pm.max_children = 50

;pm.start_servers int 設置啟動時創建的子進程數目。僅在 pm 設置為 dynamic 時使用。默認值:min_spare_servers + (max_spare_servers - min_spare_servers) / 2。

pm.start_servers = 20

pm.min_spare_servers = 10

pm.max_spare_servers = 30

pm.max_requests = 500

pm.process_idle_timeout = 10s

request_terminate_timeout = 30

request_slowlog_timeout = 0

pm.status_path = /php-fpm_status

slowlog = log/slow.log

rlimit_files = 2048

rlimit_core = 0

catch_workers_output = yes

;env[HOSTNAME] = iZ28qwahedc

env[PATH] = /usr/local/bin:/usr/bin:/bin

env[TMP] = /tmp

env[TMPDIR] = /tmp

env[TEMP] = /tmp

有其他需要看的請留言 我會馬上貼上來,謝謝了!

總結

以上是生活随笔為你收集整理的linux系统nginx启动不了,nginx启动不了,求大神帮助!的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。