Using the Nginx echo Agent in Ubuntu to configure multiple sites under one port

Source: Internet
Author: User
Tags nginx server
using the Nginx echo Agent in Ubuntu to configure multiple sites under one port
Under a server, there is no domain name, multiple domain name is easy here do not do too much description.

The IP of a server is as follows: 192.168.1.101 default Niginx 80 port. Project directory under/var/www/html we create another project directory in/var/www/wecaht
If we have access to 192.168.1.101/wechat we need to configure the following:

I still need another port, like 8001. Create a new profile under/etc/nginx/sites-available WeChat 
    listen 8001;
    server_name wechat.com;

    Root/var/www/wechat;
    Index index.php index.html index.htm;

    # make site accessible from http://localhost/
    server_name localhost;
    Location ~* \. (Eot|otf|ttf|woff) $ {
        add_header Access-control-allow-origin *;
    }
    Location/{
            # attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.< C14/>try_files $uri $uri//index.php $args;
            # Uncomment to enable NAXSI on this location
            # include/etc/nginx/naxsi.rules
    }

Ln-s/etc/nginx/sites-available/etc/nginx/sites-enable/wechat
Create a soft connection
Save Launch service Nginx restart
Visit 192.168.1.101:8001 we will visit the PHP project in the WeChat directory
Now we add the reverse proxy to the default profile/etc/nginx/sites-available/default
location/wechat/{
Proxy_pass http://192.168.1.101:8001;
}

Then restart the Nginx server

Visiting Http://192.168.1.101/wechat is OK.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.