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

Source: Internet
Author: User

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

The directory structure of the site is html├──bbs└──www

HTML is the default installation directory for the source code path.

BBS for Forum program source code path WWW for Home 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 is the forum other two-level 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 is 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   500 502 503 504   /50x.html;        location = /50x.html {             root   html;         }         # pass the PHP scripts to  fastcgi server listening on 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;         }&nbsP;       # deny access to .htaccess files, if  apache ' S document root        # concurs with  nginx ' s one        #         location ~ /.ht {             deny  all;        }    }

A summary of the steps is

1. Replace the above red configuration with your domain name and add it to your nginx.conf profile

2. Confirm the level two domain name you want to add, such as bbs.yourdomain.com

3. Set bbs.yourdomain.com resolution to your Nginx server IP

4. Create BBS directory in HTML directory

5. Put the source into the BBS directory

6. Reload the Nginx configuration

Kill-hup ' cat/usr/local/lnmp/nginx/nginx.conf '

(You 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.