Nginx tuning and domain locking


how can I get nginx to redirect any domain name requests to one unique domain name (possible in apache), and where is the default welcome to nginx page located in the file structure. Also, how can I bench test nginx at all? How do I know how fast it is and how much load it can handle if I need to change the hardware parameters…


put following lines into nginx config of every site

if ($host !~* ^www\.sitename\.com$ ) {  
    rewrite ^(.*)$$1 permanent;  


reload nginx service
this will redirect request to


just fill in the “sitename” with local site name, correct? and this goes into the nginx.conf file, right? does it matter where this line gets placed?


To get nginx redirect any domain name request to on unique domain please follow this:

  1. create config file in /etc/nginx/sites-available/ like
    2.add these lines in newly created file
server {  
        server_name _;  
        return 301  http://www.sitename$request_uri;  
  1. then enable redirection using ee site enable
  2. service nginx reload
    This will redirect all domain requests to sitename

For Bencharking follow our tutorial link

note : Please forget previous solution.


great…thanks…I will check it out…So far great product!


Hey any of you guys at rtcamp interested in moving to the united states…as a entrepreneur and permanent? send me a email.