Configure Optimization

使用单个独立配置文件(非主配置文件)

原配置文件如下

cat /application/nginx/conf/nginx.conf
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  www.imaginist.xyz;
        location / {
            root   html/www;
            index  index.html index.htm;
        }
    }
    server {
        listen       80;
        server_name  blog.imaginist.xyz;
        location / {
            root   html/blog;
            index  index.html index.htm;
        }
    }
    server {
        listen       80;
        server_name  bbs.imaginist.xyz;
        location / {
            root   html/bbs;
            index  index.html index.htm;
        }
    }
}

建立配置目录并写入配置

检查并启动

nginx 停止和启动命令

终极方法

Last updated