[root@centos7-1 system]# cd /opt/vickie/nginx
[root@centos7-1 nginx]# ll
总用量 8
drwx------ 2 nobody root 6 11月 28 18:54 client_body_temp
drwxr-xr-x 2 root root 4096 11月 28 18:45 conf
drwx------ 2 nobody root 6 11月 28 18:54 fastcgi_temp
drwxr-xr-x 2 root root 40 11月 28 18:45 html
drwxr-xr-x 2 root root 4096 11月 28 18:45 include
drwxr-xr-x 2 root root 58 12月 15 14:05 logs
drwxr-xr-x 2 root root 6 11月 28 18:45 modules
drwx------ 2 nobody root 6 11月 28 18:54 proxy_temp
drwxr-xr-x 2 root root 52 12月 14 20:11 sbin
drwx------ 2 nobody root 6 11月 28 18:54 scgi_temp
drwx------ 2 nobody root 6 11月 28 18:54 uwsgi_temp
[root@centos7-1 nginx]# cd conf
[root@centos7-1 conf]# ll
总用量 72
-rw-r--r-- 1 root root 5202 12月 14 20:11 browsers
-rw-r--r-- 1 root root 1034 11月 28 18:45 fastcgi.conf
-rw-r--r-- 1 root root 1034 12月 14 20:11 fastcgi.conf.default
-rw-r--r-- 1 root root 964 11月 28 18:45 fastcgi_params
-rw-r--r-- 1 root root 964 12月 14 20:11 fastcgi_params.default
-rw-r--r-- 1 root root 2837 12月 14 20:11 koi-utf
-rw-r--r-- 1 root root 2223 12月 14 20:11 koi-win
-rw-r--r-- 1 root root 4053 11月 28 18:45 mime.types
-rw-r--r-- 1 root root 4053 12月 14 20:11 mime.types.default
-rw-r--r-- 1 root root 3349 12月 14 20:11 module_stubs
-rw-r--r-- 1 root root 2799 11月 28 18:45 nginx.conf
-rw-r--r-- 1 root root 2799 12月 14 20:11 nginx.conf.default
-rw-r--r-- 1 root root 596 11月 28 18:45 scgi_params
-rw-r--r-- 1 root root 596 12月 14 20:11 scgi_params.default
-rw-r--r-- 1 root root 623 11月 28 18:45 uwsgi_params
-rw-r--r-- 1 root root 623 12月 14 20:11 uwsgi_params.default
-rw-r--r-- 1 root root 3610 12月 14 20:11 win-utf
[root@centos7-1 conf]# vi nginx.conf
[root@centos7-1 conf]# cp nginx.conf nginx.conf.bak
[root@centos7-1 conf]# vi nginx.conf
[root@centos7-1 system]# cd /opt/vickie/nginx
[root@centos7-1 nginx]# ll
总用量 8
drwx------ 2 nobody root 6 11月 28 18:54 client_body_temp
drwxr-xr-x 2 root root 4096 12月 16 10:25 conf
drwx------ 2 nobody root 6 11月 28 18:54 fastcgi_temp
drwxr-xr-x 2 root root 40 11月 28 18:45 html
drwxr-xr-x 2 root root 4096 11月 28 18:45 include
drwxr-xr-x 2 root root 58 12月 15 14:05 logs
drwxr-xr-x 2 root root 6 11月 28 18:45 modules
drwx------ 2 nobody root 6 11月 28 18:54 proxy_temp
drwxr-xr-x 2 root root 52 12月 14 20:11 sbin
drwx------ 2 nobody root 6 11月 28 18:54 scgi_temp
drwx------ 2 nobody root 6 11月 28 18:54 uwsgi_temp
[root@centos7-1 conf]# vi nginx.conf
[root@centos7-1 conf]# cat nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
# load modules compiled as Dynamic Shared Object (DSO)
#
#dso {
# load ngx_http_fastcgi_module.so;
# load ngx_http_rewrite_module.so;
#}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name www.vickie.com
location / {
root /mnt;
auto_index on;
}
}
server {
listen 80;
server_name www.360.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
[root@centos7-1 conf]# systemctl status nginx.service
● nginx.service - nginx service
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) (Result: exit-code) since 日 2019-12-15 14:05:38 CST; 21h ago
Process: 15709 ExecReload=/opt/vickie/nginx/sbin/nginx -s reload (code=exited, status=1/FAILURE)
Process: 6506 ExecStart=/opt/vickie/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
Main PID: 6507 (nginx)
Tasks: 2
CGroup: /system.slice/nginx.service
├─6507 nginx: master process /opt/vickie/nginx/sbin/nginx
└─6509 nginx: worker process
12月 16 10:53:03 centos7-1 systemd[1]: nginx.service: control process exited, code=exited...s=1
12月 16 10:53:03 centos7-1 systemd[1]: Reload failed for nginx service.
12月 16 10:59:32 centos7-1 systemd[1]: Reloading nginx service.
12月 16 10:59:32 centos7-1 nginx[14638]: nginx: [emerg] directive "server_name" is not te...:44
12月 16 10:59:32 centos7-1 systemd[1]: nginx.service: control process exited, code=exited...s=1
12月 16 10:59:32 centos7-1 systemd[1]: Reload failed for nginx service.
12月 16 11:16:56 centos7-1 systemd[1]: Reloading nginx service.
12月 16 11:16:57 centos7-1 nginx[15709]: nginx: [emerg] directive "server_name" is not te...:44
12月 16 11:16:57 centos7-1 systemd[1]: nginx.service: control process exited, code=exited...s=1
12月 16 11:16:57 centos7-1 systemd[1]: Reload failed for nginx service.
Hint: Some lines were ellipsized, use -l to show in full.
[root@centos7-1 conf]# vi +44 nginx.conf
[root@centos7-1 conf]# systemctl reload nginx.service
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
[root@centos7-1 conf]# systemctl