Support the ongoing development of Laravel.io →
posted 10 years ago
Configuration
Last updated 2 years ago.
0

I successfully set up my nginx server-config to run laravel.

I see your root is not set correctly (assuming you have a traditional laravel installation and not symlinking). Here is my root setting:

root /srv/www/hostname/public;

My setup runs on CentOS 6 following a guide here: Install and configure Nginx, MySQL & PHP-FPM in CentOS 6

There is a section there for a laravel config block.

Good luck

Last updated 2 years ago.
0

wagonerwebworks said:

My setup runs on CentOS 6 following a guide here: Install and configure Nginx, MySQL & PHP-FPM in CentOS 6

There is a section there for a laravel config block.

Thank you for the link! That was very useful since I'm probably going to use CentOS in the future for my web host :D

I finally found out what my problem was. It's been a while since I've touched a Laravel application so I'm a bit rusty. I was forgetting to do chmod -R o+w app/storage for my app to work with the web server. It worked when I did artisan serve but that a php development server so it's different.

The root is alright since this is my local machine and I never use the root of the web server. I only use a "userdir" sort of under /home/username/sites hence the following block from my nginx config:

# Userdir - php
       location ~ ^/~([^/]+)/(.+\.php)$ {
        if (!-f /home/$1/sites/$2) {
            rewrite ^ 404;
        }
        alias /home/$1/sites/$2;
	fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        include /etc/nginx/fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME    $request_filename;
}
 
# Userdir - static
location ~ ^/~([^/]+)(/.*)?$ {
             alias /home/$1/sites$2;
             autoindex on;
}

I bookmarked the site you posted for future reference. Thanks again.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

villimagg villimagg Joined 12 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.