我想运行我的两个服务器,如IP:9000和IP:8080 NGNIX

时间:2018-04-16 07:36:22

标签: nginx server localhost web-hosting

我的ngnix默认文件有如下服务器块

server {
    listen     80;
    #listen       443 ssl http2 default_server;
    #listen       [::]:443 ssl http2 default_server;
    server_name  myIP;
    root         /var/www/html/web/admin_and_store_panel/; 

    #ssl_certificate "/etc/letsencrypt/live/<YOUR_DOMAIN_NAME>/fullchain.pem";
    #ssl_certificate_key "/etc/letsencrypt/live/<YOUR_DOMAIN_NAME>/privkey.pem";
    #ssl_session_cache shared:SSL:1m;
    #ssl_session_timeout  10m;
    #ssl_ciphers HIGH:!aNULL:!MD5;
    #ssl_prefer_server_ciphers on;

    #Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
      proxy_pass http://localhost:8080;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection 'upgrade';
      proxy_set_header Host $host;
      proxy_cache_bypass $http_upgrade;
    }

    error_page 404 /404.html;
      location = /errorPage.html {
    }

    # force https-redirects
    #if ($scheme = http) {
    #    return 301 https://$server_name$request_uri;
    #}
 }

只有一个带ip的项目才能正常工作 就像我可以通过端口8080用ip

访问我的项目

但我想要的是运行IP:8080和IP:9000这两个项目 我可以这样做吗?

0 个答案:

没有答案