fachinformatiker-wiki

it's easy when it's here

User Tools

Site Tools


linux:webhosting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:webhosting [2020/11/24 23:09] adminlinux:webhosting [2024/02/17 19:03] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Webhosting Befehle ======+====== Webhosting Commands ======
  
 <code> <code>
Line 8: Line 8:
 sudo systemctl restart nginx sudo systemctl restart nginx
 </code> </code>
 +
 +===== htpasswd =====
 +
 +Generate Basic Auth Credentials
 +
 +==== Installation ====
 +<code>
 +sudo apt update
 +sudp apt install htpasswd
 +</code>
 +
 +==== Generate Credentials ====
 +<code>
 +htpasswd -n werner                                # generate cerdentials for user "werner" and display the results 
 +                                                  # on standard output rather than updating a file
 +htpasswd -c ~/public_html/.htpasswd werner        # generate ".htpasswd" file and create credentials for user "werner"
 +htpasswd ~/public_html/.htpasswd werner           # create or modify credentials for user "werner" in ".htpasswd" file
 +</code>
 +
 +=== Traefik ===
 +
 +** Don't forget to escape dollar signs ($ -> $$) in traefik docker compose files! **
 +
 +use this command:
 +
 +<code>
 +echo $(htpasswd -nB werner) | sed -e s/\\$/\\$\\$/g
 +</code>
 +
 +in the docker compose file:
 +<code>
 +...
 +    labels:
 +      - "traefik.enable=true"
 +      - "traefik.docker.network=traefik-prod"
 +      - "traefik.http.services.nginx-web-prod.loadbalancer.server.port=8180"
 +      - "traefik.http.routers.nginx-web-prod.middlewares=basicauth-prod"
 +      - "traefik.http.middlewares.basicauth-prod.basicauth.users=werner:$$apr1$$3FS0FG.s$$rc0h/7C36ABYDS45XKEQ."
 +...
 +</code> 
linux/webhosting.1606255797.txt.gz · Last modified: 2024/02/17 19:03 (external edit)