Показать статистику
0 голосов
от (2.4тыс. баллов)

Мне нужно использовать Joomla для нескольких сайтов на одном сервере. Доступк к конфигам есть. Сейчас конфин отдельно взятого сайта выглядит так:

 server {
    listen 80;
    server_name www.mywebsite.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;
    }
}

С конфигом проблем нет, все вроде бы работает как нужно. Когда я ввожу в браузере www.mywebsite.com все открывается. Но мне нужно другое - я хочу что бы при обращении к URL www.myserver.com/myjoomlasite вебсайт тоже открывался. Как это настроить?

244 просмотров 1 ответов

1 Ответ

0 голосов
от (17.4тыс. баллов)

Я думаю что вам нужно перезаписать документ рут примерно так:

location /page/ {
    root /my/local/path/library/content/folder/country;
}

Либо второй вариант: добавить www.myserver.com к директиве server_name.

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

Так ваш сайт заработает сразу по нескольким URL:

  • www.myserver.com/joomlasite/
  • www.myserver.com
  • www.myjoomlasite.com
  • www.myjoomlasite.com/joomlasite/
...