Webinoly is just the perfect tool for NGINX experts. Give it a try!
0 votes
997 views
by Rookie
edited by
Hi

i am trying to add a loading screen for my garrys mod server, but the ingame browser does not support https :(

so i thoughed about an agent check:
if useragent = gmod, than http, else redirect https

how am i able to implement this correctly?

1 Answer

0 votes
by Rookie

thats now my nginx-conf
 

# WebinolySSLredirectStart - HTTP to HTTPS Redirect

server {

listen 80;

listen [::]:80;

server_name subdomain.domain.tld;

if ($http_user_agent != 'Mozilla/5.0 (Windows; Valve Source Client) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1003.1 Safari/535.19 Awesomium/1.7.5.1 GMod/13') {

return 301 https://$host$request_uri;

}

access_log off;

error_log /var/log/nginx/subdomain.domain.tld.error.log;

root /var/www/subdomain.domain.tld/htdocs;

index  index.php index.html index.htm;

include common/auth.conf;

# WebinolyCustom

# WebinolyCustomEnd

include common/php.conf;

include common/locations.conf;

include common/headers-http.conf;

include common/headers-html.conf;

include /var/www/subdomain.domain.tld/*-nginx.conf;

}

# WebinolySSLredirectEnd

# WebinolyNginxServerStart

server {

listen 443 ssl http2;

listen [::]:443 ssl http2;

server_name subdomain.domain.tld;

# WebinolySSLstart

ssl_certificate /etc/letsencrypt/live.domain.tld/fullchain.pem;

ssl_certificate_key /etc/letsencrypt/live.domain.tld/privkey.pem;

ssl_stapling on;

ssl_stapling_verify on;

ssl_trusted_certificate /etc/letsencrypt/live.domain.tld/chain.pem;

# WebinolySSLend

access_log off;

error_log /var/log/nginx/subdomain.domain.tld.error.log;

root /var/www/subdomain.domain.tld/htdocs;

index  index.php index.html index.htm;

include common/auth.conf;

# WebinolyCustom

# WebinolyCustomEnd

include common/php.conf;

include common/locations.conf;

include common/headers-http.conf;

include common/headers-https.conf;

include common/headers-html.conf;

include /var/www/subdomain.domain.tld/*-nginx.conf;

}

# WebinolyNginxServerEnd

but after an update the config could be overwritten, right? how am i able to create a custom nginx-conf in var/www/subdomain.domain.tld/ ? what should the config look like?

by Expert

Site nginx conf files (vhosts) are not overwritten during the update process, only global nginx files are updated and this happens only when the stack versión is raised (see: sudo webinoly -v), not always.

I have to mention that "sometimes" these files can be updated to modify just one specific line or value during the update process and as I mentioned before, only when the stack version is raised, not always.

Welcome to the Community site for Webinoly.

Our Optimized LEMP Web Server is a powerful set of commands for doing just about anything you could wish.

With Webinoly you can set up your NGINX web server in just one step.

* * * * * * *

To report a bug, please create a new issue on GitHub or ask a question here with the bug tag.
Webinoly Support Paypal Donations

PayPal · GitHub Sponsors · Bitcoin

It is very important that any visitor to the site read the disclaimer, terms of use and privacy and legal statement before start browsing.

...