Nginx deployment of multiple domain name issues

Source: Internet
Author: User
Little Brother PHP Beginner.
Recently, the Nginx deployment of multiple domain names has been tangled for a long time.
Nginx installed on the Linux virtual machine, you want to enter the domain name on Win7 's real machine to display the Web page configured on Linux.
The configuration in Nginx is this:
server {       listen       ;       server_name www.abuwo.com;       root/storage/www/abc.com;       Error_page   502 503 504  /50x.html;       Access_log Logs/abc.com.access.log;       Location =/50x.html {          root   html;       }       Location/{           if (!-e $request _filename) {               rewrite ^/(. *) $/index.php?/$1;           }       }       Location ~*\.php$ {           try_files $uri = 404;           Fastcgi_pass phpfpm;           Fastcgi_index index.php;           Include fastcgi.conf;       }}


Reply to discussion (solution)

Configure multiple server domains, set a different server_name and root, restart it (remember to add the domain name to the Hosts file for Windows)

Configure multiple server domains, set a different server_name and root, restart it (remember to add the domain name to the Hosts file for Windows)



is the IP address corresponding to the domain name of such a map scatter?
Is it like the following?
10.96.112.238    abc1.com10.96.112.238    abc2.com

Is the same IP address followed by a number of different domain names?

Configure multiple server domains, set a different server_name and root, restart it (remember to add the domain name to the Hosts file for Windows)



Is there a directory path for that root, a relative path, or an absolute path?
Do you want to add/?

server_name www.abuwo.com;
root/storage/www/abc.com;

Do you understand me?

Steps such as

Nginx Configuration

There are two index.html in the corresponding test1 and test2 directories
Visit the following

server_name www.abuwo.com;
root/storage/www/abc.com;

Do you understand me?



Just ask if you don't understand.

Steps such as

Nginx Configuration

There are two index.html in the corresponding test1 and test2 directories
Visit the following



My nginx is on a Linux virtual machine.
What is the root path?

I follow the online tutorial installed, but has been 404 Not Found
I don't know what the mistake is.
My little brother is really confused.

I this is Linux, your root is pointing to your site's root directory, Linux is the absolute path to/start

404 What happens when I visit a URL? This is more critical.
In addition, look at Nginx error log to go, you can know the 404 when the actual request which page.

I this is Linux, your root is pointing to your site's root directory, Linux is the absolute path to/start



And if my page is in/usr/local/nginx/html/www/abc.com,
Root is going to write the full path above, right?

In addition, is the final abc.com a directory or a file? Before someone said it was a file.
But according to your statement is the catalogue it?

404 What happens when I visit a URL? This is more critical.
In addition, look at Nginx error log to go, you can know the 404 when the actual request which page.



Both the input IP and the input domain name are displayed 404

Look at the error log to go. Be good at using the information given by the system.

The example has been written for you, why don't you try it?
Root/usr/local/nginx/html/www/abc.com
ABC.com is the folder where you store your website files, the path also says, is the absolute path

The example has been written for you, why don't you try it?
Root/usr/local/nginx/html/www/abc.com
ABC.com is the folder where you store your website files, the path also says, is the absolute path



It's all tried.

The example has been written for you, why don't you try it?
Root/usr/local/nginx/html/www/abc.com
ABC.com is the folder where you store your website files, the path also says, is the absolute path



Thank you for the results.

If I put my page in/usr/local/nginx/html/www/abc.com,
Root is going to write the full path above, right?
Yes
root/usr/local/nginx/html/www/abc.com;

This/usr/local/nginx/html/www/abc.com is the directory where the website is stored
When there are multiple sites, there may be
/usr/local/nginx/html/www/www.com
/usr/local/nginx/html/www/abc.com
/usr/local/nginx/html/www/def.com
......

  • Related Article

    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.