How To Change Root Directory

Discussion in 'Installation/Configuration' started by Yamiraan, May 12, 2019.

  1. Yamiraan

    Yamiraan New Member

    Hi hope some experts help me with this issue, i want to install Laravel so want to change root directory adding a public folder, this my root path now
    want to change it with
    im attaching my config file, please guide me what change i have to make in the config file, thanks

    server {
            listen 276.310.199.53:80;
            root   /var/www/;
            index index.html index.htm index.php index.cgi index.xhtml;
            error_page 400 /error/400.html;
            error_page 401 /error/401.html;
            error_page 403 /error/403.html;
            error_page 404 /error/404.html;
            error_page 405 /error/405.html;
            error_page 500 /error/500.html;
            error_page 502 /error/502.html;
            error_page 503 /error/503.html;
            recursive_error_pages on;
            location = /error/400.html {
            location = /error/401.html {
            location = /error/403.html {
            location = /error/404.html {
            location = /error/405.html {
            location = /error/500.html {
            location = /error/502.html {
            location = /error/503.html {
            error_log /var/log/ispconfig/httpd/;
            access_log /var/log/ispconfig/httpd/ combined;
            location ~ /\. {
                deny all;
            location ^~ /.well-known/acme-challenge/ {
                access_log off;
                log_not_found off;
                root /usr/local/ispconfig/interface/acme/;
                autoindex off;
                index index.html;
                try_files $uri $uri/ =404;
            location = /favicon.ico {
                log_not_found off;
                access_log off;
                expires max;
                add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
            location /stats/ {
                index index.html index.php;
                auth_basic "Members Only";
                auth_basic_user_file /var/www/clients/client0/web10/web//stats/.htpasswd_stats;
            location ^~ /awstats-icon {
                alias /usr/share/awstats/icon;
            location ~ \.php$ {
                try_files /770c5e963cea9e76a741ea357f025aee.htm @php;
            location @php {
                try_files $uri =404;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass unix:/var/lib/php7.0-fpm/web10.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
    Gwyneth Llewelyn likes this.
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    What config file is that?
    Is Laravel installed in website created with ISPConfig?
    I have to admit I am quite confused here.
  3. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    Basically you just need to:
    1. Change to "root /var/www/;" in the website nginx config;
    2. Upload site files/folders to that "public" folder and non-site files/folders to "web" folder;
    3. Restart nginx.

    Note: Though it is also possible to use "/var/www/", you might have problems using it if you are not well-versed with linux and/or ISPConfig, thus, this approach is highly discouraged.
    Last edited: May 14, 2019
    Gwyneth Llewelyn likes this.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Gwyneth Llewelyn and ahrasis like this.

Share This Page