• nginx多虚拟主机配置 Leone


    touch /tmp/php-cgi.sock
    chown nginx.nginx /tmp/php-cgi.sock     (注意:每次php-fpm重启之后,会改变这个文件的所有者身份)


    mkdir /var/www/log
    chmod -R 777 /var/www/log


    chown -R nginx.nginx /var/www/html


    相关阅读:
    CentOS 6.* yum安装配置lnmp服务器(Nginx+PHP+MySQL)
    nginx以unix-domain-socket方式连接fastcgi(php)

    nginx配置详细说明



    =====================/etc/nginx/nginx.conf===================================

    user nginx nginx;
    worker_processes 1;

    pid /var/run/nginx.pid;

    events {
        use epoll;
        worker_connections  1024;
    }

    http {
        include       /etc/nginx/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  /var/log/nginx/access.log  main;
        error_log /var/www/log/nginx_error.log crit;

        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 300m;

        sendfile        on;
        tcp_nopush     on;
        server_tokens off;

        #keepalive_timeout  0;
        keepalive_timeout  60;

        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 64k;
        fastcgi_buffers 4 64k;
        fastcgi_busy_buffers_size 128k;
        fastcgi_temp_file_write_size 128k;

        gzip on;
        gzip_min_length  1k;
        gzip_buffers     4 16k;
        gzip_http_version 1.1;
        gzip_comp_level 2;
        gzip_types       text/plain application/x-javascript text/css application/xml;
        gzip_vary on;

        # Load config files from the /etc/nginx/conf.d directory
        # The default server is in conf.d/default.conf
        # include /etc/nginx/conf.d/*.conf;

        server {
            listen       80;
            server_name  127.0.0.1;

            charset UTF-8;

            root   /var/www/html;
            index  index.html index.htm index.php;

            #只记录错误日志
            error_log  /var/www/log/default_www.log crit;

            error_page  404              /404.html;
            error_page  500 502 503 504  /50x.html;

            location ~ .php$ {
                fastcgi_pass   unix:/tmp/php-cgi.sock;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
            }

            #location ~ /.ht {
            #     deny  all;
            #}
        }

        include /etc/nginx/vhost/*.conf;
    }


    ====================/etc/nginx/vhost/*.conf==================================

    server {
        listen       80;
        server_name www.5000gl.com;

        root /var/www/html/www.5000gl.com;
        index index.html index.htm index.php;

        error_log  /var/www/log/5000gl_www.log  crit;

        location ~ .php$ {
            fastcgi_pass   unix:/tmp/php-cgi.sock;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

        location /status {
            stub_status on;
            access_log   off;
        }

        location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {
            expires  30d;
        }

        location ~ .*.(js|css)?$ {
            expires  12h;
        }

    }
  • 相关阅读:
    Oracle导出txt文本文件
    oracle spool
    [Oracle, MySQL] Oracle通过dblink连接MySQL
    正则表达式速查表
    常用的正则表达式
    python3 打印九九乘法口诀表
    canda 常用命令
    python3 拼接字符串的7种方法
    Python 字符串格式化输出方式
    PyCharm 解决有些库(函数)没有代码提示
  • 原文地址:https://www.cnblogs.com/doseoer/p/4007562.html
Copyright © 2020-2023  润新知