I have just installed a fresh copy of Laravel 5 into /var/www
.
When I browse to the server I get net::ERR_CONNECTION_REFUSED.
My Nginx config (default) is:
server {
listen 80;
root /var/www/public;
index index.php index.html index.htm;
server_name _;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Any idea what I'm doing wrong?
I am also confused about sites-enabled and sites-available. Where should default actually go?
I have moved default from sites-available to sites-enabled and I am now getting a 403 with "Access denied".
You probably got net::ERR_CONNECTION_REFUSED because you hadn't told nginx what port to listen on (note the listen 80
line in your config file), so you were trying to a port that wasn't open - hence the connection refused error.
As for sites-available
vs sites-enabled
, that's a Debian/Ubuntu thing to make sites easier to manage - you can have many sites configured in sites-available
, but only run specific ones by adding a link in sites-enabled
pointing at the respective config file in sites-available
.
As an example, my sites-enabled
folder has
lrwxrwxrwx 1 root root 40 Feb 8 07:53 site.net -> /etc/nginx/sites-available/site.net
No copying, just a link to sites-available.
For your 403 error, look in your error log for what precisely is failing. It should be located at /var/log/nginx/error.log
- look for error_log
in your main conf file to get the exact location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With