Net :: ERR_CONNECTION_REFUSED with Nginx and Laravel 5

I just installed a fresh copy of Laravel 5 in /var/www


When I browse the server I get net :: ERR_CONNECTION_REFUSED.

My Nginx config (default):

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 am doing wrong?

I am also confused about sites and sites. Where to go by default?

I went by default from sites accessible to sites and now I am getting 403 with "Access denied".


source to share

1 answer

You probably got net :: ERR_CONNECTION_REFUSED because you didn't tell nginx which port to listen on (note the line listen 80

in your config file), so you tried to open a port that wasn't open - hence the connection was rejected.

As far as sites-available

vs is concerned sites-enabled

, it's easier for Debian / Ubuntu to simplify site management - you can have many sites configured in sites-available

, but just run certain ones by adding a link to sites-enabled

pointing to the appropriate config file in sites-available


As an example, my folder sites-enabled


lrwxrwxrwx 1 root root 40 Feb  8 07:53 -> /etc/nginx/sites-available/


No copying, just link to available sites.

For your 403 error, take a look in the error log to see exactly what failed. It should be located at /var/log/nginx/error.log

- search error_log

in your main conf file to get the exact location.



All Articles