Please help me

Hi guys,

I’m new to nginx. Just knew how to use it few months ago.

I got a QuickSSL SSL, but I would like to install it only on mybb admin
folder only (http://myforum.com/admin will rewrite to
https://myforum.com/admin) and keep the rest of the site uses http.

Only http://myforum.com/admin will redirect to
https://myforum.com/admin. It didn’t work with any existing file inside
admin (for example: admin/index.php).

Here is my current nginx config:

server {
listen 80;
server_name domain.com www.domain.com;
root /var/www/domain.com;
include /etc/nginx/fastcgi_php;
index index.php index.html;
location / {

    }
}
location /admin {
    rewrite ^/ https://$http_host$request_uri permanent;
}

}

server {
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/csr.csr;
ssl_certificate_key /etc/nginx/ssl/csr.key;
keepalive_timeout 60;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;

server_name domain.com www.domain.com;
root /var/www/domain.com;
include /etc/nginx/fastcgi_php;
index index.php index.html;
location / {
    rewrite ^ http://$http_host$request_uri permanent;
}
location /admin {
}

}

I don’t know how to fix it, please help.

Thank in advanced,
Giang

Posted at Nginx Forum:

server {
listen 80;
server_name domain.com www.domain.com;
root /var/www/domain.com;
include /etc/nginx/fastcgi_php;
index index.php index.html;
rewrite ^/admin https://$http_host$request_uri permanent;
}

server {
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/csr.csr;
ssl_certificate_key /etc/nginx/ssl/csr.key;
keepalive_timeout 60;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;

server_name domain.com www.domain.com;
root /var/www/domain.com;
include /etc/nginx/fastcgi_php;
index index.php index.html;
location / {
rewrite ^/ http://$http_host$request_uri permanent;
}
location ~ ^/admin {
break;
}
}

MagicBear

Posted at Nginx Forum:

Thank you for your help. But there is some issues. The Browsers didn’t
recognize my SSL :frowning:

Posted at Nginx Forum:

On Thu, Sep 08, 2011 at 01:36:09PM -0400, magicbear wrote:

server {
listen 80;
server_name domain.com www.domain.com;
root /var/www/domain.com;
include /etc/nginx/fastcgi_php;
index index.php index.html;
rewrite ^/admin https://$http_host$request_uri permanent;
}

It’s better to move /admin rewrite inside “location ^~ /admin”.


Igor S.

On Thu, Sep 08, 2011 at 10:20:44AM -0400, Giang wrote:

admin (for example: admin/index.php).

    }
}
location /admin {
  • location /admin {
    
  • location ^~ /admin {
    
    rewrite ^/ https://$http_host$request_uri permanent;
}

}


Igor S.

And I have no idea why would you enable sslv2 and even sslv3.

Posted at Nginx Forum:

On Wed, Oct 05, 2011 at 08:52:10AM -0400, Giang wrote:

Thank you for your help. But there is some issues. The Browsers didn’t
recognize my SSL :frowning:

http://nginx.org/en/docs/http/configuring_https_servers.html#chains


Igor S.

Thank you all for helping me. I didn’t clearly about why browsers didn’t
recognize my SSL.

If I remove:
location / {
rewrite ^/ http://$http_host$request_uri permanent;
}

The SSL was working fine, I think there were some objects still linking
using http. Is there any help to solve the problem?

Posted at Nginx Forum: