Multi-SERVER_NAME sequence of nginx Virtual Hosts

Source: Internet
Author: User
Tags mediawiki

The nginx configuration file does not have relevant rewrite jump rules, so it should be the PHP of mediawikiProgramHowever, after traversing all the files in the mediawiki directory and querying every table in the MySQL database, no such domain name is found. Later, you can viewSource codeMediawiki jumps based on $ _ server ['server _ name'] and finds the following problems:

In an nginx virtual host, you can bind multiple SERVER_NAME, for example:

The order of SERVER_NAME is different. It may affect the use of $ _ server ["SERVER_NAME"] Or getenv ('server _ name') in PHP programs to obtain server domain names:



$ _ Server ["SERVER_NAME"] Or getenv ('server _ name') always gets the first domain name in the nginx SERVER_NAME configuration, which requires attention during program development. The first domain name is equivalent to servername in the Apache Virtual Host Configuration, and the 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.