devCU Software Development – Custom Solutions and Services
  • HomedevCU Home
  • TutorialsLearn Here
  • devForumdev Forums
  • ProjectsDCU Dev
  • ServicesOur Specialty
    • Join Us
    • Contact devCU
  • RepositoryCode Depot
  • devCU NewsThe Latest

Creating Nginx SSL Subdomains

Secure your sites pages in Nginx
Home » Nginx Tutorials » Creating Nginx SSL Subdomains
Jun, Thu 21st, 2012 Posted in : Nginx Tutorials By : PlanetMaster 0 Comments Tags: Creating Nginx SSL Subdomains, install ssl nginx, Installing SSL on subdomains on Nginx, nginx, nginx conf ssl, nginx ssl, nginx ssl certificate, nginx vhost ssl, ssl on subdomains, ssl on subdomains in nginx

Creating Nginx SSL subdomainsCreating Nginx SSL Subdomains

Creating Nginx SSL Subdomains is easy but this took me a bit of time to get right. Once I figured out the process most everything else with Nginx became allot easier…First we want to create our subdomain. I am using ISPconfig to do this but any control panel that works solely with Nginx will do the trick. This will not apply to those using Nginx as a frontend for Apache on cPanel server. This is pure Nginx server no Apache.

The following makes all requests go to https by using the redirect in the http (port 80) block. The following is a standard server block, I have left out any custom directives for easier reading.

Installing SSL on subdomains on Nginx
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
server {
                listen IPaddress:80;
                server_name sub.domain.com;
 
#################### SSL Only Please
rewrite         ^ https://$server_name$request_uri? permanent;
                                }
server {
                listen 443;
                server_name sub.domain.com;
 
                error_log /var/log/ispconfig/httpd/domain.com/sub_error.log;
                access_log /var/log/ispconfig/httpd/domain.com/sub_access.log combined;
 
################### Sub Domain Root
 
                root /var/www/domain.com/web/sub;
 
################### SSL Directives
 
                ssl on;
                ssl_certificate /var/www/domain.com/ssl/sub.domain.com.pem;
                ssl_certificate_key /var/www/domain.com/ssl/sub.domain.com.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;
 
#################### Page Extension Directives
 
                index index.php index.html index.htm index.cgi index.pl index.xhtml;
 
#################### The Error Pages
 
                error_page 400 /error/400.html;
                error_page 401 /error/401.html;
                error_page 403 /error/403.html;
                error_page 404 /error/404.html;
                error_page 405 /error/405.html;
                error_page 500 /error/500.html;
                error_page 502 /error/502.html;
                error_page 503 /error/503.html;
 
#################### Standard Directives
 
                ## Disable .htaccess and other hidden files
                location ~ /\. {
                        deny all;
                        access_log off;
                        log_not_found off;
                }
 
                location = /favicon.ico {
                        log_not_found off;
                        access_log off;
                }
 
                location = /robots.txt {
                        allow all;
                        log_not_found off;
                        access_log off;
                }
 
                location /stats {
                        index index.html index.php;
                        auth_basic "Members Only";
                        auth_basic_user_file /var/www/clients/client1/web1/.htpasswd_stats;
                }
 
######################### PHP-FPM Fast CGI Directives
 
                                location ~ \.php$ {
                                         try_files $uri =404;
                                         include /etc/nginx/fastcgi_params;
                                         fastcgi_pass 127.0.0.1:9010;
                                         fastcgi_index index.php;
                                         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                                         fastcgi_param HTTPS on;
                                         fastcgi_buffer_size 128k;
                                         fastcgi_buffers 256 4k;
                                         fastcgi_busy_buffers_size 256k;
                                         fastcgi_temp_file_write_size 256k;
                                         fastcgi_intercept_errors on;
                                }
 
################### Server Your Static ZFiles
 
                # serve static files directly
                location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
                         access_log             off;
                }
}

After you are dont configuring, save your file and restart Nginx

PHP
1
# /etc/init.d/nginx restart

So Creating Nginx SSL Subdomains isnt that difficult and you can use the same process to secure your domains, subdomains, and directories.

Reference: Nginx HttpSslModule

More code, copy code ability, full support, and your comments here

devCU Guides

  • Centos (2)
  • devCU News (3)
  • FTP Servers (2)
  • IPB (invision Power Board) (1)
  • Nginx Tutorials (8)
  • Redmine (1)
  • Wordpress (1)

Site Links

  • Centos Tutorials Guides
  • Contact devCU
  • devCU Projects
  • devCU Services
  • devCU Sitemap
  • devCU Tutorials
  • FTP Servers
  • IPB Tutorials Guides
  • Join Us
  • Nginx Tutorials Guides
  • Payment Complete
  • WordPress Tutorials Guides

devCU Social

Tweet

Popular Tags

changing pureftpd port Creating Nginx SSL Subdomains external links in nginx ftp port change hide urls in nginx how to change ftp port Installing SSL on subdomains on Nginx install ssl nginx keep your data secure nginx nginx auth basic nginx conf ssl nginx link transparency nginx phpmyadmin security nginx protect directories nginx proxy Nginx Proxy for External Link Invisibility nginx security nginx ssl nginx ssl certificate nginx ssl phpmyadmin Nginx SSL Secured phpMyAdmin nginx url redirect nginx vhost ssl phpmyadmin plesk 11 plesk 11 nginx plesk nginx plesk nginx configuration plesk nginx proxy plesk nginx usage Plesk Panel 11.0 for Linux introduces Nginx pureftpd pureFTPd - Changing default connection port pureftpd port pureftpd security secure phpmyadmin in nginx security pureftpd ssl encryption ssl on subdomains ssl on subdomains in nginx ssl secured phpmyadmin SSL Secured phpMyAdmin with Nginx wordpress ipb nginx Wordpress IPB Nginx Friendly URLS

Latest Posts

  • SSL TLS Secure pureFTPd port connections
  • Install Redmine 2.0.3 Nginx Centos 6
  • WHMCS Nginx Centos 6
  • Install Ioncube Nginx Centos 6
  • devCU Screams Pure Nginx
  • WordPress IPB Nginx Friendly URLS
  • Plesk Panel 11 Linux introduces Nginx
  • Nginx SSL Secured phpMyAdmin
  • Nginx Proxy External Link Invisibility
  • Creating Nginx SSL Subdomains
  • pureFTPd Changing default connection port
  • Nginx Auth Basic directory protection
  • DevCU Public License DCUPL

Tweets @devcu

No public Twitter messages

Site Links

  • Centos Tutorials Guides
  • Contact devCU
  • devCU Projects
  • devCU Services
  • devCU Sitemap
  • devCU Tutorials
  • FTP Servers
  • IPB Tutorials Guides
  • Join Us
  • Nginx Tutorials Guides
  • Payment Complete
  • WordPress Tutorials Guides
© 2012 devCU Software Development. All Rights Reserved.
Powered by Exceptional Servers Web Services
Tweet