1

My laptop is running Ubuntu 14.10 desktop and hosting 14.10 server in a libvirt VM (set up using virt-manager). I installed it in minimal virtual server mode with only openssh-server. After installation, I could easily SSH into it and added nginx stable PPA and installed it as well.

Here's the problem: browsers say "the connection attempt was rejected." It's not a networking issue as I can SSH, but I can't figure out what could be. I didn't go anywhere near iptables or whatever it's successor is called, and it's entire network configuration is thanks to libvirt's default network DHCP.

Please feel free to ask about any configuration details you need to know.

2
  • Have you switched of the firewall, or opened the port – Anthon Dec 27 '14 at 17:46
  • @Anthon Like I said, I didn't touch any network configuration. I don't think Ubuntu Server's default behavior would be to block the port either. – Oxwivi Dec 27 '14 at 17:48
0

I figured out the issue. As I suspected, it had nothing to do with the networking stack, and the blame fell squarely upon nginx misconfiguration. I purged all the configuration files and reinstalled nginx and as it turned out, there was not one, but two reasons that led to the nginx refusing to work at all.

First there was /etc/nginx/sites-enabled/www (the only enabled virtual host); turns out I had two fastcgi_pass defined:

location ~ \.php$ {
    include snippets/fastcgi-php.conf;

    # With php5-cgi alone:
    fastcgi_pass 127.0.0.1:9000;
    # With php5-fpm:
    fastcgi_pass unix:/var/run/php5-fpm.sock;
}

All was fine in the world, until I edited the following lines into /etc/nginx/nginx.conf under the Basic Settings section:

client_max_body_size  4096k;
client_header_timeout 10;
client_body_timeout   10;
keepalive_timeout     10 10;
send_timeout          10;

Now I've no idea exactly which lines and why they caused the issue, I couldn't be bothered to. I was following an old and outdated guide (published 2012, quite old by IT standards) to set up my web server stack, so moral of the story? Don't blindly follow a guide, and check exactly what each instruction does and it's still relevant on the version of software you're using. Ah, but the fastcgi_pass was my mistake, not due to the guide.

0

Try with this config:

try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;

Edit your "keepalive_timeout 10 10; " to

keepalive_timeout 10;

And you can edit max body size:

client_max_body_size 20m;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.