| 
					比如我在本机新建了一个 域名如 c.com
 现在把 static.c.com 绑定到 /uploads子目录下。 请问要怎么操作? | |
| 沙发#发布于:2016-12-02 12:37 
					目前的方法就是1再新建一个站点绑定二级域名,然后自定义路径到想要的目录。				 | |
| 板凳#发布于:2016-12-02 14:39 | |
| 地板#发布于:2016-12-02 14:51 
					以前在 amh.sh是这么写的。但是它要安装一个 rewrite模块才行。 if ( $host = 'static.c.com' ){ set $subdomain "/uploads"; } 现在我把这代码照抄进去,却没效。 | |
| 4楼#发布于:2016-12-02 17:57 
					根据我的方法来吧,实现了目的即可。				 | |
| 5楼#发布于:2016-12-02 19:59 
					目前这样可以做出来,就是效果不太好。
 缺点有二: 1,"static.c.com" 要写成正则的,写不来。 2,假如我放一个php在uploads目录下面,它是可以执行的。达不到禁止的目的。 这一行不知道要怎么改才行。location ~* ^.*/(static|uploads|attachment|attachm server { listen 80; server_name c.com *.c.com; set $subdomain ''; #如果 static.x.com则转到 uploads下面。 if ($host = "static.c.com" ) { set $subdomain "uploads"; } root C:/website/wwwroot/c.com/web/$subdomain; index index.php index.html default.php app.php u.php; include C:/website/wwwroot/c.com/web/up-*.conf; location / { } autoindex off; include advanced_settings.conf; #include expires.conf; # ([^/.]+) location ~* ^.*/(static|uploads|attachment|attachments|uploadfiles|avatar)\/.*\.(php|php5|phps|asp|aspx|jsp)$ { deny all; } location ~ ^.+\.php { #root C:/website/wwwroot/c.com/web; fastcgi_pass bakend; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi.conf; } } #server c.com end} | |
 
							
 
				
 
				





