Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Nginx + Laravel - Moving blog from subdomain to /blog

location /blog {
        alias /home/ploi/blog.server.com/public;
        
        try_files $uri $uri/ @blogrewrite;

        location ~ .php$ {
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        }   
    }

    location @blogrewrite {
        rewrite /blog/(.*)$ /blog/index.php?/$1 last;
    }
 
PREVIOUS NEXT
Tagged: #Nginx #Laravel #Moving #blog #subdomain
ADD COMMENT
Topic
Name
6+7 =