Changing port on which Nginx listens?

Gilles Ganault gilles.ganault at
Fri Jul 16 17:31:06 MSD 2010

On Fri, 16 Jul 2010 14:08:50 +0200, Jérôme Loyet
<jerome at> wrote:
>what's the content of index.php ? try by simply set <?php phpinfo(); ?>

Damn, now it's working, and I can't figure out why I couldn't connect
to it before :-)

Removing Nginx entirely (--purge), reinstalling, trying 80 then 8787,
with index.html or index.php works fine now. Go figure.

To solve the 403 issue, I simply added  "index.html" to the list of
default resources:

# cat /etc/nginx/sites-available/default
server {
    #listen 80 default;
    listen 8787 default;
    server_name  localhost;
    access_log  /var/log/nginx/localhost.access.log;
    root   /var/www/nginx-default;

    location / {
        #CHANGED index  index.php;
        index index.php index.html;

    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
      access_log        off;
      expires           30d;

    location ~ \.php$ {
        include fastcgi_params;

        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_pass   backend;
        fastcgi_index  index.php;

        fastcgi_param  SCRIPT_FILENAME

        fastcgi_intercept_errors        on;
        fastcgi_ignore_client_abort     off;
        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 180;
        fastcgi_read_timeout 180;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;

## Disable viewing .htaccess & .htpassword
    location ~ /\.ht {
        deny  all;

upstream backend {

Sorry guys about the trouble, and thanks for your help.

More information about the nginx mailing list