Hello,
I have a plugin so that my server can use a nginx server and the plugin does work for none SSL sites. I am trying to get the nginx server to also handle the SSL connections but i ran in to a problem that i have to manually add the SSL.conf files. All i want to do is make a bash script so if a domain installs SSL or the autoSSL that it gets the key, cert and cabundle files for that giving domain and it makes a SSL.conf file for that domain for the nginx server.
Here is a copy of the SSL.conf file
All i need it to do is make that file and change a few thing to the info need.
replace CHANGEME.com and www.CHANGEME.com with the domain name
replace it with the SSL cert path and file name.
replace it with the SSL key path and file name.
replace it with the SSL cabundle path and file name.
Then it saves the new SSL.conf file but the name would be domain.ssl.conf the domain would be the domain name for that SSL and would save the file in the /etc/nginx/conf.d folder and then execute service nginx restart command.
Can any one help me with this please?
I have a plugin so that my server can use a nginx server and the plugin does work for none SSL sites. I am trying to get the nginx server to also handle the SSL connections but i ran in to a problem that i have to manually add the SSL.conf files. All i want to do is make a bash script so if a domain installs SSL or the autoSSL that it gets the key, cert and cabundle files for that giving domain and it makes a SSL.conf file for that domain for the nginx server.
Here is a copy of the SSL.conf file
Code:
# /**
# * @version 1.7.2
# * @package Engintron for cPanel/WHM
# * @author Fotis Evangelou
# * @url https://engintron.com
# * @copyright Copyright (c) 2010 - 2016 Nuevvo Webware P.C. All rights reserved.
# * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
# */
server {
listen 443 ssl http2;
server_name CHANGEME.com www.CHANGEME.com;
ssl_certificate /var/cpanel/ssl/installed/certs/CHANGEMESSL.crt;
ssl_certificate_key /var/cpanel/ssl/installed/keys/CHANGEMESSL.key;
ssl_trusted_certificate /var/cpanel/ssl/installed/cabundles/CHANGEMESSL.cabundle;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 60m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
http2_max_field_size 16k;
http2_max_header_size 32k;
# mozilla recommended
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+ECDSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+SHA384:EECDH+AES128:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!CAMELLIA;
ssl_prefer_server_ciphers on;
ssl_buffer_size 1369;
ssl_session_tickets on;
# deny all; # DO NOT REMOVE OR CHANGE THIS LINE - Used when Engintron is disabled to block Nginx from becoming an open proxy
set $CONNECTION_TYPE https;
set $PROXY_TO_PORT 444;
set $PROXY_DOMAIN_OR_IP $host;
# Set custom rules like domain/IP exclusions or redirects here
include custom_rules;
location / {
try_files $uri $uri/ @backend;
}
location @backend {
include proxy_params_common;
# === MICRO CACHING ===
# Comment the following line to disable 1 second micro-caching for dynamic HTML content
include proxy_params_dynamic;
}
# Enable browser cache for static content files (TTL is 1 hour)
location ~* \.(?:json|xml|rss|atom)$ {
include proxy_params_common;
include proxy_params_static;
expires 1h;
add_header Pragma "public";
add_header Cache-Control "public";
add_header Vary "Accept-Encoding";
access_log off;
}
# Enable browser cache for CSS / JS (TTL is 30 days)
location ~* \.(?:css|js)$ {
include proxy_params_common;
include proxy_params_static;
expires 30d;
add_header Pragma "public";
add_header Cache-Control "public";
add_header Vary "Accept-Encoding";
access_log off;
}
# Enable browser cache for media & document files (TTL is 60 days)
location ~* \.(?:ico|jpg|jpeg|gif|png|bmp|webp|tiff|mp3|flac|ogg|mid|midi|wav|wma|mp4|mov|3gp|webm|mkv|ogv|wmv|zip|7z|tgz|gz|rar|bz2|tar|exe|pdf|doc|docx|xls|xlsx|ppt|pptx|rtf|odt|ods|odp)$ {
include proxy_params_common;
include proxy_params_static;
expires 60d;
add_header Pragma "public";
add_header Cache-Control "public";
access_log off;
}
# Enable browser cache for fonts & fix @font-face cross-domain restriction (TTL is 60 days)
location ~* \.(eot|ttf|otf|woff|woff2|svg|svgz)$ {
include proxy_params_common;
include proxy_params_static;
expires 60d;
add_header Pragma "public";
add_header Cache-Control "public";
add_header Vary "Accept-Encoding";
add_header Access-Control-Allow-Origin *;
access_log off;
}
# Prevent logging of favicon and robot request errors
location = /favicon.ico {
include proxy_params_common;
include proxy_params_static;
expires 60d;
add_header Pragma "public";
add_header Cache-Control "public";
access_log off;
log_not_found off;
}
location = /robots.txt {
include proxy_params_common;
include proxy_params_static;
expires 1d;
add_header Pragma "public";
add_header Cache-Control "public";
access_log off;
log_not_found off;
}
location = /nginx_status {
stub_status;
access_log off;
log_not_found off;
# Uncomment the following 2 lines to make the Nginx status page private.
# If you do this and you have Munin installed, graphs for Nginx will stop working.
#allow 127.0.0.1;
#deny all;
}
location = /whm-server-status {
proxy_pass http://127.0.0.1:8080;
# Comment the following 2 lines to make the Apache status page public
allow 127.0.0.1;
deny all;
}
# Deny access to hidden files
location ~ /\.ht {
deny all;
}
}
Code:
server_name CHANGEME.com www.CHANGEME.com;
Code:
ssl_certificate /var/cpanel/ssl/installed/certs/CHANGEMESSL.crt;
Code:
ssl_certificate_key /var/cpanel/ssl/installed/keys/CHANGEMESSL.key;
Code:
ssl_trusted_certificate /var/cpanel/ssl/installed/cabundles/CHANGEMESSL.cabundle;
Then it saves the new SSL.conf file but the name would be domain.ssl.conf the domain would be the domain name for that SSL and would save the file in the /etc/nginx/conf.d folder and then execute service nginx restart command.
Can any one help me with this please?