nginx secondary domain name matches the root directory of the sub-folders

2010-05-24  来源:本站原创  分类:Internet  人气:291 

Binding domain
server_name *. abcd.com;
Get host name
if ($ host ~ * (.*) \ .(.*) \ .(.*))
(
set $ domain $ 1;
)
Definition List
root html / abc / $ domain /;
location /
(
root html / abcd / $ domain;
index index.html index.php;
)

-------------------------------------------------- ------------------------

Domain www.domain.com
Path / home / www /

In / home / www / folder to bind under the appropriate second level domain it domain?

For example / home / www / linuxtone / bind linuxtone.domain.com this two domain names, and set the www.domain.com folder under the relevant direct access, such as / home / www / css / can use www. domian.com / css / visit

Using the following method could bind the two corresponding domain name, but there is no way to set access www.domian.com folder under

server_name *. abcd.com;
Get host name
if ($ host ~ * (.*) \ .(.*) \ .(.*))
(
set $ domain $ 1;
)
Definition List
root html / abc / $ domain /;
location /
(
root html / abcd / $ domain;
index index.html index.php;
)

How to configure the appropriate nginx.conf file

-------------------------------------------------- ------------------------

After two days of cramming the regular expression & Research debug log, the complete solution to deploy magento to rewrite two directory problem, the key is fast cgi the param request_uri

Description under, / work / work my web_root directory

/ Work / work / WebSite is put magento directory

192.168.0.111 is my IP of the machine

php-cgi running on port 9000

nginx + fastcgi php seems no where to go fast, windows, so it was a

worker_processes 2;
worker_rlimit_nofile 51200;

events
(
worker_connections 51200;
)

http
(
include mime.types;
default_type application / octet-stream;

# Charset gb2312;

server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;

sendfile on;
tcp_nopush on;

keepalive_timeout 60;

tcp_nodelay on;

fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;

gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text / plain application / x-javascript text / css application / xml;
gzip_vary on;

server (
listen 80;
server_name 192.168.0.111; # modified for your server name
# Access_log / var / log / nginx / access.log;
root / work / work;
autoindex on;
# Setting for magento
location ~ * / website /(.*) \. (png | gif | jpg | jpeg | css | js | swf | ico) $ (
access_log off;
expires 30d;
)
# Setting for multi store in magento
location ~ * ^ / website / cctvhotdeals (
if (!-e $ request_filename) (
rewrite ^(.+)$ / WebSite / cctvhotdeals / index.php last;
)
fastcgi_pass 192.168.0.111:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_NAME $ fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME / work / work $ fastcgi_script_name;
include fastcgi_params;
access_log off;
expires 30d;
)

location ~ * ^ / website / js / index.php (
fastcgi_pass 192.168.0.111:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_NAME $ fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME / work / work $ fastcgi_script_name;
include fastcgi_params;
access_log off;
expires 30d;
)

location ~ * ^ / website (
if (!-e $ request_filename) (
rewrite ^(.+)$ / WebSite / index.php last;
)
fastcgi_pass 192.168.0.111:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_NAME $ fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME / work / work $ fastcgi_script_name;
include fastcgi_params;
)
# End of setting for magento

# Pass the PHP scripts to FastCGI socket
location ~ \. php $ (
fastcgi_pass 192.168.0.111:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_NAME $ fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME / work / work $ fastcgi_script_name;
include fastcgi_params;
)

location / (
root / work / work;
index index.html index.htm index.php;
)

)
)

相关文章
  • nginx secondary domain name matches the root directory of the sub-folders 2010-05-24

    Binding domain server_name *. abcd.com; Get host name if ($ host ~ * (.*) \ .(.*) \ .(.*)) ( set $ domain $ 1; ) Definition List root html / abc / $ domain /; location / ( root html / abcd / $ domain; index index.html index.php; ) -------------------

  • Implementation in secondary domain 2010-02-24

    With the optimization of the depth and maturity of the Internet, two domain names and web sites for independent of the relationship between the primary domain name more and more subtle; this evolving trend will gradually mature. Which saw a lot of pe

  • html in the link url to the root directory, or the parent directory 2010-07-19

    1. With the site's domain name on it, such as: "../../../ index.htm "into: 127.0.0.1/index.htm 2. With the code: local_path=Request.SeverVariables("local_addr") path=local_path & "/index.htm" With an absolute path from th

  • A VPS, a top-level domain, an independent IP, how to configure multiple secondary domain name sites? 2010-08-31

    Hire a new web VPS, only one top-level domain, an independent IP, how to configure multiple secondary domain name sites? If the top-level domain name: www.AAA.com Site visit required: a.AAA.com as an independent web site b.AAA.com for another indepen

  • IXWebhosting use workpress, how to redirect to the root directory 2010-05-30

    I searched a number of articles , through the wordpress directory ". htaccess" file and "index.php" file to the site root directory and then modify the index.php in the link to point to. But do not produce results. After repeatedly try

  • VFS + SFTP root directory redirection 2010-06-09

    In order to project requirements SFTP helpless on the floor of the Apache in the VFS. Online introduction to the VFS few official DOC can be ignored. Found no SFTP access to the root directory where to begin debugging VFS. Finally resolved the issue

  • weblogic root directory as an application in the default directory (zz) 2010-08-11

    Use the root directory as the default directory, need to create a new project can be called index, and then the WEB-INF directory below to create a new weblogic.xml, content <! - <br /> <br /> Code highlighting produced by Actipro CodeHighl

  • [Reprinted] WordPress root directory file 2010-09-19

    http://cn.yflying.com/2010/06/wordpress% E6% A0% B9% E7% 9B% AE% E5% BD% 95% E6% 96% 87% E4% BB% B6 / WordPress root directory (Root) index.php: WordPress core index file, that blog output file. license.txt: WordPress GPL license file. my-hacks.php:

  • [Reproduced] WordPress root directory file 2010-09-19

    http://cn.yflying.com/2010/06/wordpress% E6% A0% B9% E7% 9B% AE% E5% BD% 95% E6% 96% 87% E4% BB% B6 / WordPress root directory (Root) index.php: WordPress core index file, that blog output file. license.txt: WordPress GPL license file. my-hacks.php:

  • Set the Apache HTTP Server document root directory (DocumentRoot) 2010-09-29

    Set the Apache HTTP Server document root directory (DocumentRoot). Apache is installed, the system will set a default document root directory. If you think there is the default directory the page is not convenient, think we should also set up a direc

  • Absolute path to the root directory of the project 2010-12-03

    The PHP system development, the introduction of the file is a very troublesome thing, because the document references will appear nested, so in this document by reference is correct, is not referenced in another document has come. php include files a

  • Struts2 Action reads web folder under the root directory of the file Uploadfile 2011-04-18

    web root directory: 109UPload 109UPload |------ Uploadfile | |------ 109.txt |------ WEB-INF Action class to read the files within the folder Uploadfile 109.txt methods are: Method One: public class SaveAction implements Action{ public static String

  • kiccp.com opening of the new secondary domain name 2011-05-08

    Today, the domain name for my secondary domain name kiccp.com enabled: blog.kiccp.com , published as a blog site KICCP information and some of my personal log.

  • win7 apache virtual host can not be listed under the root directory of the file 2011-04-19

    window7 configure virtual hosts can not list the root directory file, the solution: Open the directory listing functions: <Directory /path/to/directory> Options + Indexes </ Directory> Close out directory features: <Directory /path/to/direc

  • FTP back to the root directory 2011-08-05

    Ftpclient back to the root directory / / Client.uploadFile ("ftp /", fileIn, "test.jpg"); / / Client.changeWorkingDirectory ("/ home / neusoft /"); / / Client.uploadFile ("ftp2 /", fileIn, "test2.jpg"); If

  • window appserv secondary domain name how to parse 2011-05-13

    Server configuration: windows2003, appserv-win32-2.5.8.exe Run the program has shopex4.84 file directory: D: \ AppServ \ www wordpress-3.1.2-zh_CN directory: D: \ AppServ \ wordpress The question is: 1. Want to www.xxx.com access shopex 2. Want to ac

  • nginx unified domain approach 2010-09-09

    Requirements: test.com will be redirected to www.test.com, empathy test.com/post/1 will be redirected to the www.test.com/post/1 last - basically using the Flag break - stop Rewrite, not to match redirect - return to temporary redirect HTTP status 30

  • Linux root directory '/' use of the next folder 2011-05-13

    under linux file structure to see why each folder is used / Bin binary executable command / Dev device special file / Etc file system management and configuration / Etc / rc.d startup configuration files and scripts / Home User home directories point

  • Godaddy domain bound to the main directory and sub-domain management 2011-09-22

    Godaddy is the world's largest domain registrar, after the rapid development of the field into the host, according to a number of monitoring bodies show, placed on the number of sites on Godaddy has more first place. Godaddy also offers linux host, W

  • tomcat deploy to the root directory 2010-05-27

    Method 1: direct deploy to webapps / ROOT folder Method 2: Rename the webapps folder in the ROOT, in conf / server.xml in <Host> </ Host> add the following between the content. <Context Path="/" docBase="E:/eclisps6test/API/W