mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 04:50:47 -07:00
added ssl support
This commit is contained in:
parent
1ad0295d87
commit
9f1d16d87a
3 changed files with 38 additions and 9 deletions
|
@ -59,7 +59,6 @@ is_template_valid "proxy"
|
||||||
ip=$(get_web_domain_value '$IP')
|
ip=$(get_web_domain_value '$IP')
|
||||||
web_port=$(get_config_value '$WEB_PORT')
|
web_port=$(get_config_value '$WEB_PORT')
|
||||||
proxy_port=$(get_config_value '$PROXY_PORT')
|
proxy_port=$(get_config_value '$PROXY_PORT')
|
||||||
domain=$(get_web_domain_value '$DOMAIN')
|
|
||||||
domain_idn=$(idn -t --quiet -a "$domain")
|
domain_idn=$(idn -t --quiet -a "$domain")
|
||||||
group="$user"
|
group="$user"
|
||||||
docroot="$V_HOME/$user/domains/$domain/public_html"
|
docroot="$V_HOME/$user/domains/$domain/public_html"
|
||||||
|
@ -87,6 +86,34 @@ if [ -z "$main_conf_check" ]; then
|
||||||
echo "include $conf;" >>$main_conf
|
echo "include $conf;" >>$main_conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Checking ssl
|
||||||
|
cert=$(get_web_domain_value '$SSL_CERT')
|
||||||
|
if [ ! -z "$cert" ]; then
|
||||||
|
# Defining certificate params
|
||||||
|
ssl_cert="$V_HOME/$user/conf/$cert.crt"
|
||||||
|
ssl_key="$V_HOME/$user/conf/$cert.key"
|
||||||
|
tpl_option=$(get_web_domain_value '$SSL_HOME')
|
||||||
|
case $tpl_option in
|
||||||
|
single) docroot="$V_HOME/$user/domains/$domain/public_shtml" ;;
|
||||||
|
same) docroot="$V_HOME/$user/domains/$domain/public_html" ;;
|
||||||
|
*) check_args '3' "$#" 'user domain certificate [sslhome]'
|
||||||
|
esac
|
||||||
|
web_ssl_port=$(get_config_value '$WEB_SSL_PORT')
|
||||||
|
proxy_ssl_port=$(get_config_value '$PROXY_SSL_PORT')
|
||||||
|
|
||||||
|
# Adding domain to the snginx.conf
|
||||||
|
conf="$V_HOME/$user/conf/snginx.conf"
|
||||||
|
tpl_file="$V_WEBTPL/ngingx_vhost_$template.stpl"
|
||||||
|
httpd_add_config
|
||||||
|
|
||||||
|
# Checking vesta nginx config
|
||||||
|
main_conf='/etc/nginx/conf.d/vesta_users.conf'
|
||||||
|
main_conf_check=$(grep "$conf" $main_conf )
|
||||||
|
if [ -z "$main_conf_check" ]; then
|
||||||
|
echo "include $conf;" >>$main_conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Vesta #
|
# Vesta #
|
||||||
|
|
|
@ -51,7 +51,7 @@ field='$DOMAIN'
|
||||||
# Parsing unsuspeneded domains
|
# Parsing unsuspeneded domains
|
||||||
domains=$(dom_clear_search)
|
domains=$(dom_clear_search)
|
||||||
|
|
||||||
# Starting update disk loop
|
# Starting loop
|
||||||
for domain in $domains; do
|
for domain in $domains; do
|
||||||
|
|
||||||
# Defining domain parameters
|
# Defining domain parameters
|
||||||
|
@ -85,10 +85,9 @@ for domain in $domains; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Checking ssl
|
# Checking ssl
|
||||||
ssl=$(get_web_domain_value '$SSL')
|
cert=$(get_web_domain_value '$SSL_CERT')
|
||||||
if [ "$ssl" = 'yes' ]; then
|
if [ ! -z "$cert" ]; then
|
||||||
# Parsing certificate params
|
# Defining certificate params
|
||||||
cert=$(get_web_domain_value '$SSL_CERT')
|
|
||||||
ssl_cert="$V_HOME/$user/conf/$cert.crt"
|
ssl_cert="$V_HOME/$user/conf/$cert.crt"
|
||||||
ssl_key="$V_HOME/$user/conf/$cert.key"
|
ssl_key="$V_HOME/$user/conf/$cert.key"
|
||||||
tpl_option=$(get_web_domain_value '$SSL_HOME')
|
tpl_option=$(get_web_domain_value '$SSL_HOME')
|
||||||
|
@ -99,7 +98,7 @@ for domain in $domains; do
|
||||||
esac
|
esac
|
||||||
web_ssl_port=$(get_config_value '$WEB_SSL_PORT')
|
web_ssl_port=$(get_config_value '$WEB_SSL_PORT')
|
||||||
|
|
||||||
# Adding domain to the httpd.conf
|
# Adding domain to the shttpd.conf
|
||||||
conf="$V_HOME/$user/conf/tmp_shttpd.conf"
|
conf="$V_HOME/$user/conf/tmp_shttpd.conf"
|
||||||
tpl_file="$V_WEBTPL/apache_$template.stpl"
|
tpl_file="$V_WEBTPL/apache_$template.stpl"
|
||||||
httpd_add_config
|
httpd_add_config
|
||||||
|
|
|
@ -2,10 +2,13 @@ server {
|
||||||
listen %ip%:%proxy_ssl_port%;
|
listen %ip%:%proxy_ssl_port%;
|
||||||
server_name %domain_idn% %alias_idn%;
|
server_name %domain_idn% %alias_idn%;
|
||||||
server_name_in_redirect off;
|
server_name_in_redirect off;
|
||||||
|
ssl on;
|
||||||
|
ssl_certificate %ssl_cert%;
|
||||||
|
ssl_certificate_key %ssl_key%;
|
||||||
%elog%error_log /var/log/httpd/domains/%domain%.error.log error;
|
%elog%error_log /var/log/httpd/domains/%domain%.error.log error;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://%ip%:%web_ssl_port%;
|
proxy_pass https://%ip%:%web_ssl_port%;
|
||||||
|
|
||||||
location ~* ^.+\.(%extentions%)$ {
|
location ~* ^.+\.(%extentions%)$ {
|
||||||
root %docroot%;
|
root %docroot%;
|
||||||
|
@ -21,7 +24,7 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
location @fallback {
|
location @fallback {
|
||||||
proxy_pass http://%ip%:%web_ssl_port%;
|
proxy_pass https://%ip%:%web_ssl_port%;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~ /\.ht {deny all;}
|
location ~ /\.ht {deny all;}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue