Question about binding multiple domain names to an nginx host $ _ SERVER ["SERVER_NAME "]

Source: Internet
Author: User
Tags nginx host
Most of the normal $ _ SERVER [& quot; SERVER_NAME & quot;] in apache is found to be abnormal when the nginx virtual host is used, because fastcgi_param uses fastcgi_paramSERVER_NAME $ server_name; configuration method: Get $ _ SERVER [& quot; SER in php

During nginx VM usage, the original normal $ _ SERVER ["SERVER_NAME"] in apache is abnormal because fastcgi_param is used.

Fastcgi_param SERVER_NAME $ server_name; configuration method. when getting $ _ SERVER ["SERVER_NAME"] in php, you can only get the first bound domain name, other domain names are processed as aliases, such as Apache's ServerAlias.

Solution:

Use fastcgi_param SERVER_NAME $ host instead.

Make good use of $ _ SERVER ["SERVER_NAME"] and $ _ SERVER ["HTTP_HOST"].

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.