nginxの3人のドメイン名は、ファイルをポイントし、パラメータでパンを解析し、

需要http://www.xxx.com/company/?id=816 => http://abc.yyy.xxx.com/

プログラムは、= 816コード= ABC IDを照会することができ

次のように構成されたnginxの

server
{
		listen 80;
		server_name *.yyy.xxx.com;
		index index.html index.htm index.php default.html default.htm default.php;
		root  /home/xxx.com/website;

		include none.conf;

		location / {
				# 重点位置
				if ($host ~* ^(.*).yyy.xxx.com) {
					set $sub $1;
					rewrite ^/ /company/index.php?code=$sub last;
				}
				try_files $uri $uri/ /index.php?$args;
		}

		location ~ [^/]\.php(/|$)
		{
				# comment try_files $uri =404; to enable pathinfo
				try_files $uri =404;
				fastcgi_pass  unix:/tmp/php-cgi.sock;
				fastcgi_index index.php;
				include fastcgi.conf;
				#include pathinfo.conf;
		}

		location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
		{
				expires      30d;
		}

		location ~ .*\.(js|css)?$
		{
				expires      12h;
		}

		access_log  /home/xxx.com/access.log;
}

 

公開された21元の記事 ウォンの賞賛3 ビュー20000 +

おすすめ

転載: blog.csdn.net/zchare/article/details/81135803