Welcome! Log In Create A New Profile

Advanced

Help how i can simple rewrite for subdomain

Posted by icomers 
Help how i can simple rewrite for subdomain
December 16, 2009 01:35AM
i have try to Wildcard names as subdomain folder but i get error always :(
i'm use pcre-7.9

i have read Since nginx 0.8.25 named captures can be used in server_name:
server {
server_name ~^(www\.)?(?<domain>.+)$;
location / {
root /sites/$domain;
}
}

and i want make a simple when request comming from http://test.localhost.com/ root folder will automatic set to root /home/localhost/public_html/test when folder not found will direct to index.html or another file.

i think this instant method to create subdomain or virtual domain without edit nginx.conf

Please guidance and direction to edit my nginx_vhost.conf
This my NGINX Configuration below:
server
{
listen 192.168.1.2:80;
server_name localhost.com;
root /home/localhost/public_html;
index index.html index.htm index.php;
error_page 400 401 403 404 500 /index.html;
access_log off;
#limit_conn crawler 20;
server_name_in_redirect off;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fcgi.conf;
}

location ~* .(js|css|xml|rss|gif|jpg|jpeg|bmp|swf|avi|mp3|mpeg|mp4|html|htm|flv|atom|mml|txt|jad|wml|htc|png|tif|tiff|wbmp|ico|jng|bmp|svg|pdf)$ {
root /home/localhost/public_html;
expires 30d;
}
}
server
{
listen 192.168.1.2:80;
server_name www.localhost.com;
rewrite ^/(.*) http://localhost.com/$1 permanent;
index index.html index.htm index.php;
root /home/localhost/public_html;
error_page 400 401 403 404 500 /index.html;
access_log off;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /usr/local/nginx/conf/fcgi.conf;
}
}

Thank Before
Regards,

GhoHan
Re: Help how i can simple rewrite for subdomain
December 22, 2009 07:03PM
Who can do it thay here ??
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 120
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready