Welcome! Log In Create A New Profile

Advanced

Re: Merge HTTP & HTTPS Definition In The Same Section

Micha Glave
February 03, 2010 08:56AM
Am 03.02.2010 um 08:21 schrieb Yaoxing:

> I'm wondering if it's possible to merge the HTTP and HTTPS definition
> into one section.
I would prefer a include file.
> The situation is like this, my server serves both HTTP and HTTPS, both
> of them have the same redirecting rules. I don't want to define them in
> 2 places. I looked up the document and find that it is possible to bind
> both HTTP & HTTPS ports in the same "server" section like this:
> listen 80;
> listen 443 default ssl;
> but in this way how can I define stuff related to SSL? Such as
> certifications etc.? I tried
> if ($server_ports = 443) {
> ssl on;
> ssl_certificate /etc/ssl/abc.pem;
> ssl_certificate_key /etc/ssl/abc.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;
> }
----
server.conf

server {
listen 80;
include server_def.conf;
}

server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/abc.pem;
ssl_certificate_key /etc/ssl/abc.key;
...
include server_def.conf;
}
----
server_def.conf

server_name domain.com;
index index.php;
....
----

This way I include nearly anything reusable. (eg. drupal-conf)

Micha

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Merge HTTP & HTTPS Definition In The Same Section

Yaoxing February 03, 2010 02:28AM

Re: Merge HTTP & HTTPS Definition In The Same Section

Micha Glave February 03, 2010 08:56AM

Re: Merge HTTP & HTTPS Definition In The Same Section

Igor Sysoev February 03, 2010 08:58AM

Re: Merge HTTP & HTTPS Definition In The Same Section

Yaoxing February 04, 2010 04:20AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 190
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready