'auto'rewrite link to a folder

Pascale Camille lists at ruby-forum.com
Wed Aug 13 20:43:24 UTC 2014


Hi all,
i am looking for a 'simple rewrite rule' like typing :
FOLDER.2maxi.com
will point the folder /var/www/FOLDER/

and the folder is create by ngninx user, with winscp.


my old vps debian6, nginx-1.2.6+php, used to work fast and perfectly
with /etc/nginx/host.d/main.conf :

...
server {
listen 80;
 charset    utf-8;
 source_charset  utf-8;

server_name ~^(?<user>.+)\.2maxi\.com$;
root /var/www/$user;
    return       301 http://~^(?<user>.+)\.2maxi\.com$request_uri;

index 2maxi.com.html index.php;

error_page 405 /405.html;
       location = /405.html {
       rewrite . http://www.2maxi.com/2maxi.com.gif redirect;
       allow all;
       }
error_page 400 401 402 403 404 406 407 408 409 410 411 412 413 414 415
416 417 495 496 497 500 501 502 503 504 505 506 507 /error_page.html;
      location  /error_page.html {
           rewrite . http://www.2maxi.com/ redirect;
           allow all;
       }

  include /etc/nginx/conf.d/cache.conf;
  include /etc/nginx/conf.d/deny.conf;
  include /etc/nginx/conf.d/php.conf;
}


I reinstalled my old config under actual nginx and debian 7
when i type FOLDER..2maxi.com
web browser rewrote :
http://~^(?<user>.+)\.2maxi\.com

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list