I've got Fedora 20 on my dev machine and for smaller projects, tests and for learning purposes I'd like to not have to set up a virtual server using Vagrant all the time. So since I intend to use NGINX as the preferred web server for my future projects I use NGINX on my local machine. Before I used to use Linux Mint and found a good default server configuration for my local machine which worked well for a "userdir". Now I'm on Fedora 20 and when running a Laravel application on it no CSS or JS is available and not even HTML renders.
This is rather strange since if I try creating a regulear PHP application using just plain old PHP, and/or HTML, everything works. CSS, JS and HTML renders weather it's static or dynamic. Weather it's hardcoded into the HTML or created with PHP/JS.
If anyone is interested I've uploaded my sites-enabled coonfiguration file to the pastebin: My default site config
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
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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community