Deployment of multiple domain names in nginx for beginners.
Recently, I have been entangled in the deployment of multiple domain names in nginx for a long time.
Nginx is installed on a Linux virtual machine and you want to enter the domain name on the Windows 7 real machine to display the webpage configured on Linux.
The nginx configuration is as follows:
server { listen 80; server_name www.abuwo.com; root /storage/www/abc.com; error_page 500 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 different server_name and root, and restart (remember to add the domain name to the windows hosts file)
Configure multiple server domains, set different server_name and root, and restart (remember to add the domain name to the windows hosts file)
Is the ING of the domain name corresponding to the IP address?
Is it like the following?
10.96.112.238 abc1.com10.96.112.238 abc2.com
Is the same IP address followed by many different domain names?
Configure multiple server domains, set different server_name and root, and restart (remember to add the domain name to the windows hosts file)
Also, is the root directory path relative or absolute?
Do you want to add/at the beginning /?
Server_name www.abuwo.com;
Root/storage/www/abc.com;
Do you understand?
Steps are as follows:
Nginx configuration
There are two index.html files under the corresponding test1 and test2 directories.
Visit the following
Server_name www.abuwo.com;
Root/storage/www/abc.com;
Do you understand?
You can only ask if you do not understand it.
Steps are as follows:
Nginx configuration
There are two index.html files under the corresponding test1 and test2 directories.
Visit the following
My nginx is built on a Linux virtual machine.
What is the root path?
I installed it according to the online tutorial, but it has been 404 Not Found.
I don't know what the error is.
The younger brother cannot understand it.
In linux, your root is the root directory of your website, and in linux, it is the absolute path starting /.
404 what happens when I access a website? This is critical.
In addition, check the Nginx error log to see which page is actually requested when 404 is displayed.
In linux, your root is the root directory of your website, and in linux, it is the absolute path starting /.
If my page is stored in/usr/local/nginx/html/www/abc.com,
Does root need to write the complete path below?
In addition, is the last abc.com a directory or a file? Someone said it was a file ..
But according to your statement, is it a directory?
404 what happens when I access a website? This is critical.
In addition, check the Nginx error log to see which page is actually requested when 404 is displayed.
Whether you enter an IP address or a domain name, 404 is displayed.
View the error log. Be good at using the information provided by the system.
The example has already been written for you. why don't you give it a try?
Root/usr/local/nginx/html/www/abc.com
Abc.com is the folder where your website files are stored. The path is an absolute path.
The example has already been written for you. why don't you give it a try?
Root/usr/local/nginx/html/www/abc.com
Abc.com is the folder where your website files are stored. The path is an absolute path.
All have a try.
The example has already been written for you. why don't you give it a try?
Root/usr/local/nginx/html/www/abc.com
Abc.com is the folder where your website files are stored. The path is an absolute path.
Thank you for the result.
If my page is stored in/usr/local/nginx/html/www/abc.com,
Does root need to write the complete path below?
Yes
Root/usr/local/nginx/html/www/abc.com;
The/usr/local/nginx/html/www/abc.com Directory stores the website.
Multiple websites may exist at the same time.
/Usr/local/nginx/html/www/www.com
/Usr/local/nginx/html/www/abc.com
/Usr/local/nginx/html/www/def.com
......