Nginx Configuration Virtual Host No

Source: Internet
Author: User
Tags shebang

You want to configure the m.test.com

server {listen; # IPv4 server_name m.test.com;    # # Parametrization using hostname of access and log filenames.    Access_log Logs/localhost_access.log;    Error_log Logs/localhost_error.log;    # # Root and index files.    Root html/test;    Index index.php index.html index.htm;    # # If No favicon exists return a 204 (no content error).        Location =/favicon.ico {Try_files $uri = 204;        Log_not_found off;    Access_log off;    } # # Don ' t log robots.txt requests.        Location =/robots.txt {Allow all;        Log_not_found off;    Access_log off;    } # # Try The requested URI as files before handling it to PHP.        Location/{# # Regular PHP processing.            Location ~ \.php$ {try_files $uri = 404;            Fastcgi_pass php_processes;            Fastcgi_index index.php;            Fastcgi_param script_filename $document _root$fastcgi_script_name;        Include Fastcgi_params; }        ## Static files location ~* \.            (?: css|gif|htc|ico|js|jpe?g|png|swf) $ {expires Max;            Log_not_found off; # # need to bleed constant updates.            Send the All shebang in one # # Fell swoop.            Tcp_nodelay off;            # # Set The OS file cache.            Open_file_cache max=1000 inactive=120s;            Open_file_cache_valid 45s;            Open_file_cache_min_uses 2;        Open_file_cache_errors off;        } # # Keep a tab on the ' big ' static files. Location ~* ^.+\. (?: O Gg|pdf|pptx?)            $ {Expires 30d; # # need to bleed constant updates.            Send the All shebang in one # # Fell swoop.        Tcp_nodelay off;  }} #/location}

Root should be the root of the Web, and then access the

Reply content:

To configure the m.test.com

server {listen; # IPv4 server_name m.test.com;    # # Parametrization using hostname of access and log filenames.    Access_log Logs/localhost_access.log;    Error_log Logs/localhost_error.log;    # # Root and index files.    Root html/test;    Index index.php index.html index.htm;    # # If No favicon exists return a 204 (no content error).        Location =/favicon.ico {Try_files $uri = 204;        Log_not_found off;    Access_log off;    } # # Don ' t log robots.txt requests.        Location =/robots.txt {Allow all;        Log_not_found off;    Access_log off;    } # # Try The requested URI as files before handling it to PHP.        Location/{# # Regular PHP processing.            Location ~ \.php$ {try_files $uri = 404;            Fastcgi_pass php_processes;            Fastcgi_index index.php;            Fastcgi_param script_filename $document _root$fastcgi_script_name;        Include Fastcgi_params; }        ## Static files location ~* \.            (?: css|gif|htc|ico|js|jpe?g|png|swf) $ {expires Max;            Log_not_found off; # # need to bleed constant updates.            Send the All shebang in one # # Fell swoop.            Tcp_nodelay off;            # # Set The OS file cache.            Open_file_cache max=1000 inactive=120s;            Open_file_cache_valid 45s;            Open_file_cache_min_uses 2;        Open_file_cache_errors off;        } # # Keep a tab on the ' big ' static files. Location ~* ^.+\. (?: O Gg|pdf|pptx?)            $ {Expires 30d; # # need to bleed constant updates.            Send the All shebang in one # # Fell swoop.        Tcp_nodelay off;  }} #/location}

Root should be the root of the Web, and then access the

Your name ism.test.com

You asked for www.test.com?

Do you ping m.test.com back to show 127.0.0.*

Also, have you/etc/hosts rewrite it?

  • 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.