Use of nginx for mac

The first step is to download nginx. There are many installation commands on the Internet.

The second step is to open nginx My mac command open /usr/local/etc/nginx

The third step is to open nginx.conf to match all http except include servers/*. This can open multiple port numbers

user  www;
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;

        include       site_conf/*.conf;


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

matches one of the port numbers 8085

  server {
    listen       8085;
    server_name  localhost;

    location / {
        add_header Access-Control-Allow-Origin *;
        client_max_body_size 10m;
    }


    location ~ .*\.(gif|jpg|jpeg|png|ico|rar|zip|text|flv|bmp|swf|pdf|xls|ppt|doc|json|js|css|html|shtml|htm|map|woff|ttf)$ {
        add_header Access-Control-Allow-Origin *;
        #root  /Users/liuping/gx-web/src/;
        #root  /Users/liuping/gx-cms/src/;
        #root  /Users/liuping/Switching_to_Angular2/;
        root  /Users/liuping/gxMesVersions2/dist/;
        access_log off;
        expires 30d;
    }

    location ~  {
        #root   /Users/liuping/gx-web/src/;
        #root  /Users/liuping/gx-cms/src/;
        #root  /Users/liuping/Switching_to_Angular2/;
        #root    /Users/liuping/cmsUseNg2/dist/;
        index  app/index.html;
        #proxy_pass  http://www.gxcards.com;
       	#proxy_pass  http://twww.gxcards.com;
        #proxy_pass  http://mms.gxcards.com;
        #proxy_pass  http://tmms.gxcards.com;
        #e
        proxy_pass  http://101.201.51.207:7113;
        add_header Access-Control-Allow-Origin *;
        proxy_pass_header Server;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
    }

    
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325448428&siteId=291194637