added https support

This commit is contained in:
mohd
2024-05-14 16:59:00 +03:00
parent 8f7ddedd0d
commit 33a2253e3d
3 changed files with 48 additions and 83 deletions
+1
View File
@@ -21,5 +21,6 @@ services:
- 1119:1119 - 1119:1119
- 3724:3724 - 3724:3724
- 80:80 - 80:80
- 443:443
- 9002:9002 - 9002:9002
- 8081:8081 - 8081:8081
+1 -1
View File
@@ -13,7 +13,7 @@ case $1 in
$CMD /bin/bash -c 'cd /app/hm_stud && make && rm -rf cert/test* && cd cert && sh gen_cert.sh' $CMD /bin/bash -c 'cd /app/hm_stud && make && rm -rf cert/test* && cd cert && sh gen_cert.sh'
$CMD make -C /app/hm_gameserver $CMD make -C /app/hm_gameserver
$CMD make -C /app/hm_lobbyserver $CMD make -C /app/hm_lobbyserver
$CMD /bin/bash -c 'cd /app/hm_nginx && sed "s@\/usr\/local\/web@$(pwd)\/..\/hm_web\/@" conf/hm_nginx.conf > conf/nginx.conf && ./configure && make && make install' $CMD /bin/bash -c 'cd /app/hm_nginx && sed "s@\/usr\/local\/web@$(pwd)\/..\/hm_web\/@" conf/hm_nginx.conf > conf/nginx.conf && ./configure --with-http_ssl_module && make && make install'
$CMD /bin/bash -c 'cd /app/hm_sunwell/examples && npm install' $CMD /bin/bash -c 'cd /app/hm_sunwell/examples && npm install'
;; ;;
build_client) build_client)
+40 -76
View File
@@ -34,12 +34,44 @@ http {
server { server {
listen 80; listen 80;
server_name localhost; server_name hsmod.xyz www.hsmod.xyz; # Change to your actual domain
#charset koi8-r; location / {
return 301 https://$host$request_uri;
}
}
#access_log logs/host.access.log main; # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
server {
listen 443 ssl;
server_name hsmod.xyx www.hsmod.xyz; # Change to your actual domain
ssl_certificate /app/letsencrypt/fullchain.pem; # Path to fullchain.pem
ssl_certificate_key /app/letsencrypt/privkey.pem; # Path to privkey.pem
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384';
ssl_prefer_server_ciphers on;
ssl_dhparam /app/letsencrypt/ssl-dhparams.pem;
# FastCGI settings retained from your original config
location / { location / {
fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string; fastcgi_param QUERY_STRING $query_string;
@@ -58,84 +90,16 @@ http {
fastcgi_pass 127.0.0.1:9002; fastcgi_pass 127.0.0.1:9002;
} }
# Setup for serving static files
location /static/ { location /static/ {
root /usr/local/web; root /app/hm_nginx/../hm_web/;
if (-f $request_filename) { try_files $uri $uri/ =404;
rewrite ^/static/(.*)$ /static/$1 break;
} }
}
#location / {
# root html;
# index index.html index.htm;
#}
#error_page 404 /404.html; # Error pages configuration
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html; error_page 500 502 503 504 /50x.html;
location = /50x.html { location = /50x.html {
root html; root html;
} }
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
} }