Configure two-level domain names and multi-domain names with nginx pan domain name resolution

Source: Internet
Author: User
Tags nginx server subdomain

The configuration of two-level domain name and multi-domain Site directory structure is the default path of storing source code under the installation directory of Nginx html├──bbs└──wwwhtml. BBS for Forum program source code path WWW for home page program source code path put the corresponding program into the above path through http://www.youdomain.com access is the home page http://bbs.yourdomain.com Access to the Forum Other level two domain name analogy.        server {Listen 80;        Server_Name ~^ (? <subdomain>.+) \.yourdomain\.com$;         Root html/$subdomain;        Index index.html index.htm index.php;        Fastcgi_intercept_errors on;        Error_page 404 =/404.html;                Location/{# This is cool because no PHP are touched for static content.                # include the "? $args" part so non-default permalinks doesn ' t # break when using query string       Try_files $uri $uri/= 404; } # REDIRECT Server error pages to the static page/50x.html # Error_page 502 503 504/50x.htm        L        Location =/50x.html {root html; # Pass the PHP scripts to FastCGI server listening in 127.0.0.1:9000 # location~ \.php$ {Fastcgi_pass 127.0.0.1:9000;            Fastcgi_index index.php;            Fastcgi_param script_filename $document _root$fastcgi_script_name;            Fastcgi_param domain $subdomain;        Include Fastcgi_params; } # Deny access to. htaccess files, if Apache ' s document Root # concurs with Nginx ' s one # loc        ation ~/\.ht {deny all; }} To summarize the steps is 1. Add the above red configuration to your domain name after adding it to your nginx.conf Profile 2. Confirm the two-level domain name that you want to add, such as bbs.yourdomain.com3. Set bbs.yourdomain.com resolves to your nginx server ip4 Create BBS directory in HTML directory 5. Put the source into the BBS directory 6. Reload nginx config kill-hup ' cat/usr/local/lnmp/nginx/nginx.conf ' (need to change the path of the above command to your profile path) 7. Visit http://bbs.yourdomain.com

  

Configure two-level domain names and multi-domain names with nginx pan domain name resolution

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.