Nginx binding multiple domain names involved in the technology for the URL rewrite, you can first understand the background of knowledge and then come to learn.
Here is the domain name: www.sample.com for example
1. Create the sample.conf file in the/usr/local/nginx/conf folder
2. Write the following in it and Save:
server{ Listen; server_name sample.cn www.sample.cn; Root/home/www/sample;index index.html index.htm; CharSet Utf-8; Location/{root/home/www/sample; Index index.html index.htm; } Location ~* \. (jpg|gif|png) $ { if (-F $request _filename) {Expires max;break;}} Location ~/\.ht { deny all; }}
3. Then open the nginx.conf file and append the following to the last line:
include linkcp.conf;
4. Create the/home/www/sample folder and create the file in it index.html content as follows
5. Enter the domain name www.sample.com in the browser as shown below:
Test page!
Configuration complete
Nginx binding multiple domain names