0

I want to run multiple joomla site on a web server running nginx. I have access to the configuration files. Right now I have one configuration file for each site I run, looking like this:

 server {
    listen 80;
    server_name www.myjoomlasite.com
    server_name_in_redirect off;

    access_log /var/log/nginx/localhost.access_log main;
    error_log /var/log/nginx/localhost.error_log info;

    root /var/www/domain;
    index index.php;
    # Support Clean (aka Search Engine Friendly) URLs
    location / {
            try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    index index.php index.html index.htm default.html default.htm;
    # deny running scripts inside writable directories
    location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
            return 403;
            error_page 403 /403_error.html;
    }

    location ~ .*.php$ {
        include /opt/nginx/conf/fastcgi.conf;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    # caching of files
    location ~* \.(ico|pdf|flv)$ {
            expires 1y;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
            expires 14d;
    }

}

The above configuration works well, and when I hit www.domain.com woth my browser, my site appears.

What I want is to be able to write www.myserver.com/myjoomlasite and also see my site.

What is the best way to achieve this?

Thanks

0

You can use a rewrite statement or root. The latter is the easiest:

location /page/ {
    root /my/absolute/path/library/content/folder/country;
}
| improve this answer | |
  • Can you be a bit more specific? – tdgs Jul 21 '12 at 12:45
  • yes I can be :) – Lucas Kauffman Jul 21 '12 at 12:52
  • Sorry, this does not do what I want. – tdgs Jul 22 '12 at 8:50
  • Maybe you should clearly state what you want first :) – Lucas Kauffman Jul 22 '12 at 10:27
0

add "www.myserver.com" to your server_name line, also do what the above answer suggested (rewritten to be a little more relevant to your request).

location /joomlasite/ {
    root /path/to/your/joomla/root;
}

This will make your site available at 4 urls:

  • www.myjoomlasite.com
  • www.myjoomlasite.com/joomlasite/
  • www.myserver.com
  • www.myserver.com/joomlasite/
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.