zoukankan      html  css  js  c++  java
  • brew安装的nginx和php进行多域名配置

    nginx.conf 配置文件 根据sever域名进行配置 
    版本 nginx1.17.3 php7.2 thinkPHP5.x
    
    #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;
    }
    
    
    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  xsxcx.localhost.com; #域名名称
    
                  root   /usr/local/var/www/xsxcx/public; #网站根目录
                  index  index.html index.htm index.php; #默认打开文件
    
                  access_log  logs/xsxcx.access.log  main;
                  location / {
                  	        #下面主要是解决在url地址中省略"index.php"时使用的规则
                              if ( -f $request_filename) {
                                  break;
                              }
                              #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
                              if ( !-e $request_filename) {
                                  #地址作为将参数rewrite到index.php上
                                  rewrite ^/(.*)$ /index.php?s=/$1 last;
                              }
                          }
    
                  location ~ .php$ {
                              fastcgi_pass   127.0.0.1:9000;
                              fastcgi_index  index.php;
                             #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
                              fastcgi_split_path_info ^(.+.php)(.*)$; #新加第一句
                        	  fastcgi_param PATH_INFO $fastcgi_path_info;#新加第二句
                  	          fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                  	          include        fastcgi_params;
                          }
            }
    
    
        server {
            listen       80;
            server_name  127.0.0.1;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location / {
                root   html;
                index  index.html index.htm index.php;
    	    
    	    #下面主要是解决在url地址中省略"index.php"时使用的规则
                #if ( -f $request_filename) {
                #    break;
                #}
                #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
                #if ( !-e $request_filename) {
                #地址作为将参数rewrite到index.php上
                #    rewrite ^/(.*)$ /index.php/$1 last;
                #}
            }
    
            #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;
                fastcgi_split_path_info ^(.+.php)(.*)$; #新加第一句
          	    fastcgi_param PATH_INFO $fastcgi_path_info;#新加第二句
    	    fastcgi_param  SCRIPT_FILENAME $document_root$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;
        #    }
        #}
        include servers/*;
    }
    
    
  • 相关阅读:
    eclipse中文乱码问题解决方案
    修改Tomcat的JDK目录
    Tomcat 5.5 修改服务器的侦听端口
    HTML DOM教程 27HTML DOM Button 对象
    HTML DOM教程 24HTML DOM Frameset 对象
    Navicat for MySQL v8.0.27 的注册码
    HTML DOM教程 25HTML DOM IFrame 对象
    Tomcat 5.5 的下载和安装
    android manifest相关属性
    ubuntu10.04 下 eclipse 小结
  • 原文地址:https://www.cnblogs.com/ikai/p/11686370.html
Copyright © 2011-2022 走看看