记录一下内容,以备查阅!
注:转发的时候,是以包的名字区分的。
1、httpd.conf
server {
listen 8081;
server_name localhost;
#charset koi8-r;
access_log /home/log/localhost.access.log ;
error_log /home/log/localhost.error.log ;
location ~ ^/guahao{
proxy_set_header Host guahao.z.com;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:81;
}
location ~ ^/hos{
proxy_set_header Host hos.guahao.z.com;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:81;
}
location ~ ^/admin{
proxy_set_header Host ghadmin.z.com;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:81;
}
location ~ ^/item{
proxy_pass http://127.0.0.1:8090;
}
# location ~ !^/(guahao|hos|admin){
# proxy_pass http://127.0.0.1:8082;
# }
}
2、guahao.z.com.conf
server {
listen 81;
root /**/**/**/guahao.z.com/web/;
server_name guahao.z.com;
default_type 'text/html';
#charset GBK;
access_log /home/log/guahao.z.com.access.log ;
error_log /home/log/guahao.z.com.error.log ;
location / {
index index.html index.htm index.php;
}
#error_page 404 /404.html;
rewrite ^/guahao/(.*) /$1 last;
location ~ .*\.php {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
3、hos.guahao.z.com.conf
server {
listen 81;
root /**/**/**/hos.guahao.z.com/;
server_name hos.guahao.z.com;
default_type 'text/html';
#charset GBK;
access_log /home/log/hos.guahao.z.com.access.log ;
error_log /home/log/hos.guahao.z.com.error.log ;
location / {
index index.html index.htm index.php;
}
#error_page 404 /404.html;
rewrite ^/hos/(.*) /$1 last;
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
4、ghadmin.z.com.conf
server {
listen 81;
root /**/**/**/ghadmin.z.com/admin/;
server_name ghadmin.z.com;
default_type 'text/html';
#charset GBK;
access_log /home/log/ghadmin.z.com.access.log ;
error_log /home/log/ghadmin.z.com.error.log ;
location / {
index index.html index.htm index.php;
}
#error_page 404 /404.html;
rewrite ^/admin/(.*) /$1 last;
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}