Search code examples
phplaravelnginxforumsmf-forum

How do I install other applications alongside Laravel?


I'm building a website in Laravel 5.2 and rather than building a forum from scratch, I wish to install one such as SMF.

Laravel is currently in the root directory of my web server and I wish to keep it there as I wish to install SMF in a folder.

For example: www.example.com/smf

I'm thinking to install it in Laravel's /public folder but I'm afraid they will they conflict with each other. Is the /publicfolder the correct place to install SMF and should I use a route to point to the SMF folder?

Server: D.O droplet via Laravel Forge


Solution

  • You need to add custom rules for the folder(s) you want to use before Laravel related rules:

    location /smf/index.php(/.*)?$ {        
        fastcgi_split_path_info ^(/smf/index.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_read_timeout 1000;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        include fastcgi_params;
    }
    location /smf/ { 
        if (!-e $request_filename) {
                rewrite ^.*$ /smf/index.php last;    
            }
        try_files $uri $uri/ smf/index.php?args; 
    }
    

    Please look for sample nginx config file here.