Linux10.3 nginx Default Virtual Host

Source: Internet
Author: User
Tags curl

Edit Nginx configuration file

Vim/usr/local/nginx/conf/nginx.conf

Delete server{} Host configuration end, add at last

Include Vhost/*.confmkdir/usr/local/nginx/conf/vhost

Within the Vhost folder, create the default host profile aaa.com.conf file, edited as follows:

server{    listen default_server;  With this tag is the default virtual host    server_name aaa.com;    Index index.html index.htm index.php;    Root/data/wwwroot/default;       Site Directory, there is no need to create}

Create an HTML file in the site Directory

echo "This is a default site." >/data/wwwroot/default/index.html

Check nginx configuration file syntax, and reload configuration file

/usr/local/nginx/sbin/nginx-t/usr/local/nginx/sbin/nginx-s Reload

Test, default virtual host, no matter what domain name, will point to this site

[[email protected] default]# Curl Localhostecho "This is a default site." [Email protected] default]# curl-x127.0.0.1:80 123.comecho "This is a default site." [Email protected] default]# curl-x127.0.0.1:80 Aaa.comecho "This is a default site." [Email protected] default]# curl-x127.0.0.1:80 Www.baidu.comecho "This is a default site."

  

Linux10.3 nginx Default Virtual Host

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.