Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I've been trying to get SSL active for two directories on my site today but have so far been unsuccessful. I've tried several fixes seen here on serverfault but have not been able to get any to work.The layout of the sites is as such:

  • examplesite.com is a standard WordPress site
  • examplesite.com/shop is a MarketPress shop, a plugin for WordPress running as a part of the maine examplesite.com installation
  • examplesite.com/classifieds is a seperate WordPress installation

I need to have SSL turned on for examplesite.com/shop and examplesite.com/classifieds but have so far been unable to tailor my config properly.

If anyone has a better way to organize this or a fix to the config below, I'd be grateful.

server {
  server_name xamplesite.com www.examplesite.com;
  listen  80;
  server_tokens off;

  access_log /home/nginx/domains/examplesite.comv/log/access.log combined buffer=32k;
  error_log /home/nginx/domains/examplesite.com/log/error.log;

  root /home/nginx/domains/examplesite.com/public;

  location /shop {
    rewrite ^ https://$host$request_uri permanent;
  }

  location /classifieds {
    rewrite ^ https://$host$request_uri permanent;
  }

  location ~ /\. {
      access_log off;
      log_not_found off;
      deny all;
  }

  include /usr/local/nginx/conf/staticfiles.conf;
  include /usr/local/nginx/conf/php.conf;
  include /usr/local/nginx/conf/drop.conf;
  include /usr/local/nginx/conf/block.conf;
  include /usr/local/nginx/conf/wordpress/restrictions.conf;
  include /usr/local/nginx/conf/wordpress/wordpress.conf;
}

server {
  listen 443;
  server_name 127.0.0.1;

  access_log /home/nginx/domains/examplesite.com/log/access.log combined buffer=32k;
  error_log /home/nginx/domains/examplesite.com/log/error.log;

  root /home/nginx/domains/examplesite.com/public;

  ssl on;
  ssl_certificate      /etc/ssl/certs/example.crt;
  ssl_certificate_key  /etc/ssl/private/example.key;
  ssl_session_timeout 5m;
  ssl_protocols SSLv2 SSLv3 TLSv1;
  ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
  ssl_prefer_server_ciphers on;

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

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

  location / {
    rewrite ^ http://$host$request_uri permanent;
  }

}
share|improve this question
    
What is the problem you are having? –  Michael Hampton Sep 13 '13 at 19:49
    
I'm getting a "ERR_SSL_PROTOCOL_ERROR" every time I attempt to access the shop or classifieds URLs. –  Fr0sT Sep 13 '13 at 19:50
    
Does SSL work on any part of the site? –  Paul Sep 14 '13 at 0:46
    
On the second server block (for SSL), you have server_name 127.0.0.1;. It should be server_name yourdomain.com www.yourdomain.com. That's why the browsers couldn't connect and throw an error, instead. –  Pothi Sep 14 '13 at 6:47

1 Answer 1

Try changing listen 443; to listen 443 ssl;.

share|improve this answer
    
Still giving the same error after the change. –  Fr0sT Sep 13 '13 at 23:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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