高并发与负载均衡-nginx-配置虚拟服务-location

该博客详细记录了在CentOS7上配置Nginx以实现高并发和负载均衡的过程。通过编辑`nginx.conf`文件,创建虚拟服务并设置`location`,包括监听端口、定义服务器名称、设置静态文件路径等。博主还遇到了`server_name`指令错误的问题,并成功解决,最后成功实现了负载均衡和配置的重新加载。
摘要由CSDN通过智能技术生成

 

 

[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 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: 17683 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: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.
12月 16 11:49:46 centos7-1 systemd[1]: Reloading nginx service.
12月 16 11:49:46 centos7-1 nginx[17683]: nginx: [emerg] unknown directive "eload" in /opt...:68
12月 16 11:49:46 centos7-1 systemd[1]: nginx.service: control process exited, code=exited...s=1
12月 16 11:49:46 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]# 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;
        autoindex 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;
        }

eload failed for nginx service.

        # 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]# vi nginx.conf
[root@centos7-1 conf]# rm -rf nginx.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 12月 16 10:25 nginx.conf.bak
-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]# cp nginx.conf.bak nginx.conf
[root@centos7-1 conf]# ll
总用量 76
-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 12月 16 12:00 nginx.conf
-rw-r--r-- 1 root root 2799 12月 16 10:25 nginx.conf.bak
-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]# systemctl reload nginx.service 

[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.360.com;
    location / {
        root /mnt;
        autoindex on;
    }
    }

    server {
        listen       80;
        server_name  www.vickie.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]# cd /dev
[root@centos7-1 dev]# ll
总用量 0
crw-rw----  1 root video    10, 175 12月 14 22:12 agpgart
crw-------  1 root root     10, 235 12月 14 22:12 autofs
drwxr-xr-x  2 root root         180 12月 14 22:10 block
drwxr-xr-x  2 root root          80 12月 14 22:10 bsg
crw-------  1 root root     10, 234 12月 14 22:12 btrfs-control
drwxr-xr-x  3 root root          60 12月 14 22:10 bus
lrwxrwxrwx  1 root root           3 12月 14 22:12 cdrom -> sr0
drwxr-xr-x  2 root root          80 12月 14 22:11 centos
drwxr-xr-x  2 root root        3020 12月 14 22:14 char
crw-------  1 root root      5,   1 12月 14 22:15 console
lrwxrwxrwx  1 root root          11 12月 14 22:10 core -> /proc/kcore
drwxr-xr-x  3 root root          60 12月 14 22:10 cpu
crw-------  1 root root     10,  61 12月 14 22:12 cpu_dma_latency
crw-------  1 root root     10,  62 12月 14 22:12 crash
drwxr-xr-x  6 root root         120 12月 14 22:12 disk
brw-rw----  1 root disk    253,   0 12月 14 22:12 dm-0
brw-rw----  1 root disk    253,   1 12月 14 22:12 dm-1
crw-rw----+ 1 root audio    14,   9 12月 14 22:12 dmmidi
drwxr-xr-x  2 root root          80 12月 14 22:10 dri
crw-rw----  1 root video    29,   0 12月 14 22:12 fb0
lrwxrwxrwx  1 root root          13 12月 14 22:10 fd -> /proc/self/fd
brw-rw----  1 root disk      2,   0 12月 14 22:12 fd0
crw-rw-rw-  1 root root      1,   7 12月 14 22:12 full
crw-rw-rw-  1 root root     10, 229 12月 14 22:12 fuse
crw-------  1 root root    246,   0 12月 14 22:12 hidraw0
crw-------  1 root root     10, 228 12月 14 22:12 hpet
drwxr-xr-x  3 root root           0 12月 14 22:14 hugepages
crw-------  1 root root     10, 183 12月 14 22:12 hwrng
lrwxrwxrwx  1 root root          25 12月 14 22:12 initctl -> /run/systemd/initctl/fifo
drwxr-xr-x  4 root root         300 12月 14 22:12 input
crw-r--r--  1 root root      1,  11 12月 14 22:12 kmsg
srw-rw-rw-  1 root root           0 12月 14 22:10 log
crw-rw----  1 root disk     10, 237 12月 14 22:12 loop-control
crw-rw----  1 root lp        6,   0 12月 14 22:12 lp0
crw-rw----  1 root lp        6,   1 12月 14 22:12 lp1
crw-rw----  1 root lp        6,   2 12月 14 22:12 lp2
crw-rw----  1 root lp        6,   3 12月 14 22:12 lp3
drwxr-xr-x  2 root root         100 12月 14 22:11 mapper
crw-------  1 root root     10, 227 12月 14 22:12 mcelog
crw-r-----  1 root kmem      1,   1 12月 14 22:12 mem
crw-rw----+ 1 root audio    14,   2 12月 14 22:12 midi
drwxrwxrwt  2 root root          40 12月 14 22:10 mqueue
drwxr-xr-x  2 root root          60 12月 14 22:12 net
crw-------  1 root root     10,  60 12月 14 22:12 network_latency
crw-------  1 root root     10,  59 12月 14 22:12 network_throughput
crw-rw-rw-  1 root root      1,   3 12月 14 22:12 null
crw-------  1 root root     10, 144 12月 14 22:12 nvram
crw-------  1 root root      1,  12 12月 14 22:12 oldmem
crw-r-----  1 root kmem      1,   4 12月 14 22:12 port
crw-------  1 root root    108,   0 12月 14 22:12 ppp
crw-rw-rw-  1 root tty       5,   2 12月 16 2019 ptmx
drwxr-xr-x  2 root root           0 12月 14 22:10 pts
crw-rw-rw-  1 root root      1,   8 12月 14 22:12 random
drwxr-xr-x  2 root root          60 12月 14 22:10 raw
lrwxrwxrwx  1 root root           4 12月 14 22:12 rtc -> rtc0
crw-------  1 root root    252,   0 12月 14 22:12 rtc0
brw-rw----  1 root disk      8,   0 12月 14 22:12 sda
brw-rw----  1 root disk      8,   1 12月 14 22:12 sda1
brw-rw----  1 root disk      8,   2 12月 14 22:12 sda2
crw-rw----+ 1 root cdrom    21,   0 12月 14 22:12 sg0
crw-rw----  1 root disk     21,   1 12月 14 22:12 sg1
drwxrwxrwt  2 root root          40 12月 14 22:10 shm
crw-------  1 root root     10, 231 12月 14 22:12 snapshot
drwxr-xr-x  3 root root         200 12月 14 22:12 snd
brw-rw----+ 1 root cdrom    11,   0 12月 14 22:12 sr0
lrwxrwxrwx  1 root root          15 12月 14 22:10 stderr -> /proc/self/fd/2
lrwxrwxrwx  1 root root          15 12月 14 22:10 stdin -> /proc/self/fd/0
lrwxrwxrwx  1 root root          15 12月 14 22:10 stdout -> /proc/self/fd/1
crw-rw-rw-  1 root tty       5,   0 12月 14 22:12 tty
crw--w----  1 root tty       4,   0 12月 14 22:12 tty0
crw--w----  1 root tty       4,   1 12月 14 22:13 tty1
crw--w----  1 root tty       4,  10 12月 14 22:12 tty10
crw--w----  1 root tty       4,  11 12月 14 22:12 tty11
crw--w----  1 root tty       4,  12 12月 14 22:12 tty12
crw--w----  1 root tty       4,  13 12月 14 22:12 tty13
crw--w----  1 root tty       4,  14 12月 14 22:12 tty14
crw--w----  1 root tty       4,  15 12月 14 22:12 tty15
crw--w----  1 root tty       4,  16 12月 14 22:12 tty16
crw--w----  1 root tty       4,  17 12月 14 22:12 tty17
crw--w----  1 root tty       4,  18 12月 14 22:12 tty18
crw--w----  1 root tty       4,  19 12月 14 22:12 tty19
crw--w----  1 root tty       4,   2 12月 14 22:12 tty2
crw--w----  1 root tty       4,  20 12月 14 22:12 tty20
crw--w----  1 root tty       4,  21 12月 14 22:12 tty21
crw--w----  1 root tty       4,  22 12月 14 22:12 tty22
crw--w----  1 root tty       4,  23 12月 14 22:12 tty23
crw--w----  1 root tty       4,  24 12月 14 22:12 tty24
crw--w----  1 root tty       4,  25 12月 14 22:12 tty25
crw--w----  1 root tty       4,  26 12月 14 22:12 tty26
crw--w----  1 root tty       4,  27 12月 14 22:12 tty27
crw--w----  1 root tty       4,  28 12月 14 22:12 tty28
crw--w----  1 root tty       4,  29 12月 14 22:12 tty29
crw--w----  1 root tty       4,   3 12月 14 22:12 tty3
crw--w----  1 root tty       4,  30 12月 14 22:12 tty30
crw--w----  1 root tty       4,  31 12月 14 22:12 tty31
crw--w----  1 root tty       4,  32 12月 14 22:12 tty32
crw--w----  1 root tty       4,  33 12月 14 22:12 tty33
crw--w----  1 root tty       4,  34 12月 14 22:12 tty34
crw--w----  1 root tty       4,  35 12月 14 22:12 tty35
crw--w----  1 root tty       4,  36 12月 14 22:12 tty36
crw--w----  1 root tty       4,  37 12月 14 22:12 tty37
crw--w----  1 root tty       4,  38 12月 14 22:12 tty38
crw--w----  1 root tty       4,  39 12月 14 22:12 tty39
crw--w----  1 root tty       4,   4 12月 14 22:12 tty4
crw--w----  1 root tty       4,  40 12月 14 22:12 tty40
crw--w----  1 root tty       4,  41 12月 14 22:12 tty41
crw--w----  1 root tty       4,  42 12月 14 22:12 tty42
crw--w----  1 root tty       4,  43 12月 14 22:12 tty43
crw--w----  1 root tty       4,  44 12月 14 22:12 tty44
crw--w----  1 root tty       4,  45 12月 14 22:12 tty45
crw--w----  1 root tty       4,  46 12月 14 22:12 tty46
crw--w----  1 root tty       4,  47 12月 14 22:12 tty47
crw--w----  1 root tty       4,  48 12月 14 22:12 tty48
crw--w----  1 root tty       4,  49 12月 14 22:12 tty49
crw--w----  1 root tty       4,   5 12月 14 22:12 tty5
crw--w----  1 root tty       4,  50 12月 14 22:12 tty50
crw--w----  1 root tty       4,  51 12月 14 22:12 tty51
crw--w----  1 root tty       4,  52 12月 14 22:12 tty52
crw--w----  1 root tty       4,  53 12月 14 22:12 tty53
crw--w----  1 root tty       4,  54 12月 14 22:12 tty54
crw--w----  1 root tty       4,  55 12月 14 22:12 tty55
crw--w----  1 root tty       4,  56 12月 14 22:12 tty56
crw--w----  1 root tty       4,  57 12月 14 22:12 tty57
crw--w----  1 root tty       4,  58 12月 14 22:12 tty58
crw--w----  1 root tty       4,  59 12月 14 22:12 tty59
crw--w----  1 root tty       4,   6 12月 14 22:12 tty6
crw--w----  1 root tty       4,  60 12月 14 22:12 tty60
crw--w----  1 root tty       4,  61 12月 14 22:12 tty61
crw--w----  1 root tty       4,  62 12月 14 22:12 tty62
crw--w----  1 root tty       4,  63 12月 14 22:12 tty63
crw--w----  1 root tty       4,   7 12月 14 22:12 tty7
crw--w----  1 root tty       4,   8 12月 14 22:12 tty8
crw--w----  1 root tty       4,   9 12月 14 22:12 tty9
crw-rw----  1 root dialout   4,  64 12月 14 22:12 ttyS0
crw-rw----  1 root dialout   4,  65 12月 14 22:12 ttyS1
crw-rw----  1 root dialout   4,  66 12月 14 22:12 ttyS2
crw-rw----  1 root dialout   4,  67 12月 14 22:12 ttyS3
crw-------  1 root root     10, 239 12月 14 22:12 uhid
crw-------  1 root root     10, 223 12月 14 22:12 uinput
crw-rw-rw-  1 root root      1,   9 12月 14 22:12 urandom
crw-------  1 root root    247,   0 12月 14 22:12 usbmon0
crw-------  1 root root    247,   1 12月 14 22:12 usbmon1
crw-------  1 root root    247,   2 12月 14 22:12 usbmon2
crw-rw----  1 root tty       7,   0 12月 14 22:12 vcs
crw-rw----  1 root tty       7,   1 12月 14 22:12 vcs1
crw-rw----  1 root tty       7,   2 12月 14 22:13 vcs2
crw-rw----  1 root tty       7,   3 12月 14 22:13 vcs3
crw-rw----  1 root tty       7,   4 12月 14 22:13 vcs4
crw-rw----  1 root tty       7,   5 12月 14 22:13 vcs5
crw-rw----  1 root tty       7,   6 12月 14 22:13 vcs6
crw-rw----  1 root tty       7, 128 12月 14 22:12 vcsa
crw-rw----  1 root tty       7, 129 12月 14 22:12 vcsa1
crw-rw----  1 root tty       7, 130 12月 14 22:13 vcsa2
crw-rw----  1 root tty       7, 131 12月 14 22:13 vcsa3
crw-rw----  1 root tty       7, 132 12月 14 22:13 vcsa4
crw-rw----  1 root tty       7, 133 12月 14 22:13 vcsa5
crw-rw----  1 root tty       7, 134 12月 14 22:13 vcsa6
drwxr-xr-x  2 root root          60 12月 14 22:12 vfio
crw-------  1 root root     10,  63 12月 14 22:12 vga_arbiter
crw-------  1 root root     10, 137 12月 14 22:12 vhci
crw-------  1 root root     10, 238 12月 14 22:12 vhost-net
crw-------  1 root root     10,  58 12月 14 22:12 vmci
crw-------  1 root root     10,  57 12月 14 22:13 vsock
crw-rw-rw-  1 root root      1,   5 12月 14 22:12 zero
[root@centos7-1 dev]# mount /dev/cdrom /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@centos7-1 dev]# 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 12:04 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 logs
[root@centos7-1 logs]# ll
总用量 20
-rw-r--r-- 1 root root 4550 12月 16 12:12 access.log
-rw-r--r-- 1 root root 4735 12月 16 12:06 error.log
-rw-r--r-- 1 root root    5 12月 15 14:05 nginx.pid
[root@centos7-1 logs]# tail -f access.log 
192.168.159.1 - - [09/Dec/2019:20:21:53 +0800] "GET /favicon.ico HTTP/1.1" 404 589 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
192.168.159.1 - - [15/Dec/2019:14:05:43 +0800] "GET / HTTP/1.1" 200 555 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
192.168.159.1 - - [15/Dec/2019:14:05:43 +0800] "GET /favicon.ico HTTP/1.1" 404 589 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0)"
192.168.159.1 - - [16/Dec/2019:12:05:09 +0800] "GET /favicon.ico HTTP/1.1" 404 589 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
192.168.159.1 - - [16/Dec/2019:12:05:09 +0800] "GET / HTTP/1.1" 200 555 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
192.168.159.1 - - [16/Dec/2019:12:05:09 +0800] "GET /favicon.ico HTTP/1.1" 404 589 "http://www.vickie.com/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
192.168.159.1 - - [16/Dec/2019:12:05:10 +0800] "GET / HTTP/1.1" 200 555 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
192.168.159.1 - - [16/Dec/2019:12:06:33 +0800] "GET / HTTP/1.1" 200 162 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
192.168.159.1 - - [16/Dec/2019:12:06:33 +0800] "GET /favicon.ico HTTP/1.1" 404 586 "http://www.360.com/" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
192.168.159.1 - - [16/Dec/2019:12:12:34 +0800] "GET / HTTP/1.1" 200 4875 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
192.168.159.1 - - [16/Dec/2019:12:32:10 +0800] "GET / HTTP/1.1" 200 4875 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
192.168.159.1 - - [16/Dec/2019:12:32:12 +0800] "GET / HTTP/1.1" 200 4875 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
192.168.159.1 - - [16/Dec/2019:12:32:13 +0800] "GET / HTTP/1.1" 200 4875 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
192.168.159.1 - - [16/Dec/2019:12:32:36 +0800] "GET / HTTP/1.1" 200 4875 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
192.168.159.1 - - [16/Dec/2019:12:32:42 +0800] "GET / HTTP/1.1" 200 4875 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
192.168.159.1 - - [16/Dec/2019:12:33:35 +0800] "GET /asdfasdf HTTP/1.1" 404 583 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"

[root@centos7-1 ~]# cd /opt/vickie/nginx/
[root@centos7-1 nginx]# cd conf
[root@centos7-1 conf]# ll
总用量 76
-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 2907 12月 16 12:04 nginx.conf
-rw-r--r-- 1 root root 2799 12月 16 10:25 nginx.conf.bak
-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]# 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] "$r
    #                  '$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.360.com;
    location / {
        root /mnt;
        autoindex on;
    }
    }

    server {
        listen       80;
        server_name  www.vickie.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }
    location /ooxx.go {
        proxy_pass http://192.168.159.12;
    }

        #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
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_
        #    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 co
    #
    #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 reload nginx.service 
[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] "$r
    #                  '$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.360.com;
    location / {
        root /mnt;
        autoindex on;
    }
    }

    server {
        listen       80;
        server_name  www.vickie.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }
    location /ooxx.go {
        proxy_pass http://192.168.159.12/;
    }

        #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
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_
        #    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 co
    #
    #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 reload nginx.service 
[root@centos7-1 conf]# vi nginx.conf
[root@centos7-1 conf]# l.
.  ..  .nginx.conf.swp
[root@centos7-1 conf]# rm -fr nginx.conf.swp
[root@centos7-1 conf]# l.
.  ..  .nginx.conf.swp
[root@centos7-1 conf]# rm -fr nginx.conf.swp
[root@centos7-1 conf]# l.
.  ..  .nginx.conf.swp
[root@centos7-1 conf]# rm -rf nginx.conf.swp
[root@centos7-1 conf]# l.
.  ..  .nginx.conf.swp
[root@centos7-1 conf]# rm -f nginx.conf.swp
[root@centos7-1 conf]# 
[root@centos7-1 conf]# l.
.  ..  .nginx.conf.swp
[root@centos7-1 conf]# rm -f .nginx.conf.swp
[root@centos7-1 conf]# ls -la
总用量 80
drwxr-xr-x  2 root root 4096 12月 16 16:41 .
drwxr-xr-x 13 root root  181 11月 28 18:54 ..
-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 2968 12月 16 12:57 nginx.conf
-rw-r--r--  1 root root 2799 12月 16 10:25 nginx.conf.bak
-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]# vi nginx.conf
[root@centos7-1 conf]# systemctl reload nginx.service 
[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; 1 day 3h ago
  Process: 4224 ExecReload=/opt/vickie/nginx/sbin/nginx -s reload (code=exited, status=0/SUCCESS)
  Process: 6506 ExecStart=/opt/vickie/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
 Main PID: 6507 (nginx)
    Tasks: 2
   CGroup: /system.slice/nginx.service
           ├─4225 nginx: worker process
           └─6507 nginx: master process /opt/vickie/nginx/sbin/ng...

12月 16 11:49:46 centos7-1 systemd[1]: nginx.service: control pr...
12月 16 11:49:46 centos7-1 systemd[1]: Reload failed for nginx s...
12月 16 12:04:26 centos7-1 systemd[1]: Reloading nginx service.
12月 16 12:04:26 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 12:55:01 centos7-1 systemd[1]: Reloading nginx service.
12月 16 12:55:01 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 12:57:20 centos7-1 systemd[1]: Reloading nginx service.
12月 16 12:57:20 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 17:13:53 centos7-1 systemd[1]: Reloading nginx service.
12月 16 17:13:53 centos7-1 systemd[1]: Reloaded nginx service.
Hint: Some lines were ellipsized, use -l to show in full.
[root@centos7-1 conf]# systemctl status nginx.service 
● nginx.service - nginx service
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; ve
   Active: active (running) (Result: exit-code) since 日 2019-12-15 1
  Process: 4224 ExecReload=/opt/vickie/nginx/sbin/nginx -s reload (co
  Process: 6506 ExecStart=/opt/vickie/nginx/sbin/nginx (code=exited, 
 Main PID: 6507 (nginx)
    Tasks: 2
   CGroup: /system.slice/nginx.service
           ├─4225 nginx: worker process
           └─6507 nginx: master process /opt/vickie/nginx/sbin/nginx

12月 16 11:49:46 centos7-1 systemd[1]: nginx.service: control process
12月 16 11:49:46 centos7-1 systemd[1]: Reload failed for nginx servic
12月 16 12:04:26 centos7-1 systemd[1]: Reloading nginx service.
12月 16 12:04:26 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 12:55:01 centos7-1 systemd[1]: Reloading nginx service.
12月 16 12:55:01 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 12:57:20 centos7-1 systemd[1]: Reloading nginx service.
12月 16 12:57:20 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 17:13:53 centos7-1 systemd[1]: Reloading nginx service.
12月 16 17:13:53 centos7-1 systemd[1]: Reloaded nginx service.
[root@centos7-1 conf]# vi nginx.conf
[root@centos7-1 conf]# systemctl reload nginx.service 
[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; 1 day 3h ago
  Process: 4519 ExecReload=/opt/vickie/nginx/sbin/nginx -s reload (code=exited, status=0/SUCCESS)
  Process: 6506 ExecStart=/opt/vickie/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
 Main PID: 6507 (nginx)
    Tasks: 2
   CGroup: /system.slice/nginx.service
           ├─4521 nginx: worker process
           └─6507 nginx: master process /opt/vickie/nginx/sbin/ng...

12月 16 12:04:26 centos7-1 systemd[1]: Reloading nginx service.
12月 16 12:04:26 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 12:55:01 centos7-1 systemd[1]: Reloading nginx service.
12月 16 12:55:01 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 12:57:20 centos7-1 systemd[1]: Reloading nginx service.
12月 16 12:57:20 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 17:13:53 centos7-1 systemd[1]: Reloading nginx service.
12月 16 17:13:53 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 17:18:49 centos7-1 systemd[1]: Reloading nginx service.
12月 16 17:18:49 centos7-1 systemd[1]: Reloaded nginx service.
[root@centos7-1 conf]# vi nginx.conf
[root@centos7-1 conf]# systemctl reload nginx.service 
[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; 1 day 3h ago
  Process: 4629 ExecReload=/opt/vickie/nginx/sbin/nginx -s reload (code=exited, status=0/SUCCESS)
  Process: 6506 ExecStart=/opt/vickie/nginx/sbin/nginx (code=exited, status=0/SUCCESS)
 Main PID: 6507 (nginx)
    Tasks: 2
   CGroup: /system.slice/nginx.service
           ├─4631 nginx: worker process
           └─6507 nginx: master process /opt/vickie/nginx/sbin/ng...

12月 16 12:55:01 centos7-1 systemd[1]: Reloading nginx service.
12月 16 12:55:01 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 12:57:20 centos7-1 systemd[1]: Reloading nginx service.
12月 16 12:57:20 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 17:13:53 centos7-1 systemd[1]: Reloading nginx service.
12月 16 17:13:53 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 17:18:49 centos7-1 systemd[1]: Reloading nginx service.
12月 16 17:18:49 centos7-1 systemd[1]: Reloaded nginx service.
12月 16 17:20:12 centos7-1 systemd[1]: Reloading nginx service.
12月 16 17:20:12 centos7-1 systemd[1]: Reloaded nginx service.
[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.360.com;
    location / {
        root /mnt;
        autoindex on;
    }
    }

    server {
        listen       80;
        server_name  www.vickie.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }
    #location /ooxx.go {
    #    proxy_pass http://192.168.159.12/;
    #}
    location ~* \.go$ {
        proxy_pass http://192.168.159.12;
    }

        #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]# vi nginx.conf
[root@centos7-1 conf]# vi nginx.conf
[root@centos7-1 conf]# vi nginx.conf
[root@centos7-1 conf]# systemctl reload nginx.service 
[root@centos7-1 conf]# vi nginx.conf
[root@centos7-1 conf]# systemctl reload nginx.service 
[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;
    upstream bula {
    server 192.168.159.12;
    server 192.168.159.13;    
    }

    server {
    listen 80;
    server_name www.360.com;
    location / {
        root /mnt;
        autoindex on;
    }
    }

    server {
        listen       80;
        server_name  www.vickie.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }
    location /ooxx.go {
        proxy_pass http://bula/;
    }

        #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;
    #    }
    #}

}
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值