6

I have setup an nginx server(v1.4.6) on Ubuntu 14.04. Nginx is listening to port 80 but not on port 443.

Output of

netstat -lpn |grep :80
tcp        0      0 0.0.0.0:80              0.0.0.0:*          
LISTEN      22333/nginx     
tcp6       0      0 :::80                   :::*                 
LISTEN      22333/nginx     

But netstat -lpn |grep :443 shows nothing.

Following is result of ufw status

ufw status
Status: active

To                         Action      From
--                         ------      ----
443                        ALLOW       Anywhere
22                         ALLOW       Anywhere
80                         ALLOW       Anywhere
3306                       ALLOW       Anywhere
8080                       ALLOW       Anywhere
443 (v6)                   ALLOW       Anywhere (v6)
22 (v6)                    ALLOW       Anywhere (v6)
80 (v6)                    ALLOW       Anywhere (v6)
3306 (v6)                  ALLOW       Anywhere (v6)
8080 (v6)                  ALLOW       Anywhere (v6)

Here is my nginx confi

server {
listen 80;

server_name node.abcd.com www.node.abcd.com;

location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}
}


server {

listen 443;
listen [::]:443 ipv6only=on;

ssl on;
ssl_certificate /etc/nginx/ssl/cert_chain.crt;
ssl_certificate_key /etc/nginx/ssl/abcd.key;


root /var/www/abcd/public/public;
index index.php index.html index.htm;

server_name abcd.com;


access_log      /var/www/abcd/log/access.log;
error_log       /var/www/abcd/log/error.log;

rewrite_log on;

 location / {
        try_files   $uri $uri/ /index.php?$query_string;
}

# Remove trailing slash to please routing system.
 if (!-d $request_filename) {
        rewrite     ^/(.+)/$ /$1 permanent;
}

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
    root /usr/share/nginx/html;
}


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;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
        deny all;
}


}
2
  • 3
    Check nginx config with nginx -t and also check error_log. May be some troubles with certificate file. Sep 10, 2016 at 11:15
  • Thanks @Terra after running nginx -t command I can see there is an issue with the syntax.... thanks for your help.. Sep 10, 2016 at 15:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.