Nginx the sequence problem of multiple server_name of virtual host _linux

Source: Internet
Author: User
Tags mediawiki

Nginx configuration file does not have the relevant rewrite jump rules, then it should be MediaWiki PHP program to do the jump, but, traverse the MediaWiki directory of all files and query the MySQL database of each table, no record of this domain name is found. Later, by looking at the source code found MediaWiki is based on the $_server[' server_name '] do the jump, follow the clues, found the following issues:

In a nginx virtual host, you can bind multiple server_name, for example:
  

The server_name order of the different, to the PHP program using $_server["SERVER_NAME" or getenv (' server_name ') to obtain the server domain name is influential:
  

  

$_server["SERVER_NAME"] or getenv (' server_name ') gets always the first domain name in the Nginx server_name configuration, which needs to be noted in program development. This first domain name is equivalent to the Apache virtual host configuration in the ServerName, the following domain name is equivalent to Apache Serveralias.

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.