Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:install_authelia_on_debian_without_docker [2026-08-19 13:41] – iacchi | en:install_authelia_on_debian_without_docker [2026-08-20 15:37] (current) – iacchi | ||
|---|---|---|---|
| Line 83: | Line 83: | ||
| ==== Server section ==== | ==== Server section ==== | ||
| - | The server section for a normal installation is fairly simple, and you just need to specify the local address for the server. Before the server section you can also define the theme for the login website. | + | The server section for a normal installation is fairly simple, and you just need to specify the local address for the server. Before the server section you can also define the theme for the login website. The endpoints section and all that comes after is needed for Authelia to work behind an Nginx proxy. |
| <code yaml> | <code yaml> | ||
| Line 91: | Line 91: | ||
| server: | server: | ||
| address: ' | address: ' | ||
| + | endpoints: | ||
| + | authz: | ||
| + | auth-request: | ||
| + | implementation: | ||
| </ | </ | ||
| Line 130: | Line 134: | ||
| identity_validation: | identity_validation: | ||
| reset_password: | reset_password: | ||
| - | jwt_secret: {{fileContent "./ | + | jwt_secret: {{fileContent "/ |
| </ | </ | ||
| Line 184: | Line 188: | ||
| <code yaml> | <code yaml> | ||
| session: | session: | ||
| - | secret: {{fileContent "./ | + | secret: {{fileContent "/ |
| name: ' | name: ' | ||
| cookies: | cookies: | ||
| Line 215: | Line 219: | ||
| <code yaml> | <code yaml> | ||
| storage: | storage: | ||
| - | encryption_key: | + | encryption_key: |
| mysql: | mysql: | ||
| address: ' | address: ' | ||
| database: ' | database: ' | ||
| username: ' | username: ' | ||
| - | password: {{fileContent "./ | + | password: {{fileContent "/ |
| </ | </ | ||
| Line 233: | Line 237: | ||
| timeout: ' | timeout: ' | ||
| username: ' | username: ' | ||
| - | password: {{fileContent "./ | + | password: {{fileContent "/ |
| sender: '" | sender: '" | ||
| identifier: ' | identifier: ' | ||
| Line 247: | Line 251: | ||
| identity_providers: | identity_providers: | ||
| oidc: | oidc: | ||
| - | hmac_secret: | + | hmac_secret: |
| jwks: | jwks: | ||
| - | - key: {{ secret "./ | + | - key: {{ secret "/ |
| - | - key: {{ secret "./ | + | - key: {{ secret "/ |
| authorization_policies: | authorization_policies: | ||
| onefactor_twoadmin: | onefactor_twoadmin: | ||
| Line 280: | Line 284: | ||
| userinfo_signed_response_alg: | userinfo_signed_response_alg: | ||
| token_endpoint_auth_method: | token_endpoint_auth_method: | ||
| + | ... | ||
| </ | </ | ||
| Line 286: | Line 291: | ||
| <code yaml> | <code yaml> | ||
| authelia crypto hash generate pbkdf2 --variant sha512 --random --random.length 72 --random.charset rfc3986 | authelia crypto hash generate pbkdf2 --variant sha512 --random --random.length 72 --random.charset rfc3986 | ||
| + | </ | ||
| + | |||
| + | ===== Test the configuration file ===== | ||
| + | |||
| + | After editing the configuration file, we can test that all the secrets parse correctly by running: | ||
| + | |||
| + | <code bash> | ||
| + | authelia config template --config.experimental.filters=template --config=configuration.yml | ||
| + | </ | ||
| + | |||
| + | which should output the configuration file with all the secrets in plain text and with the correct indentation. If not, modify the configuration file to fix the issues. Before enabling Authelia as a system service, we can do a quick test run to check if it can start correctly. Run this from the command line: | ||
| + | |||
| + | <code bash> | ||
| + | authelia --config / | ||
| + | </ | ||
| + | |||
| + | If it doesn' | ||
| + | |||
| + | <code bash> | ||
| + | chown -R authelia: | ||
| + | chown authelia: | ||
| </ | </ | ||
| Line 292: | Line 318: | ||
| Authelia comes with a systemd service file that needs to be enabled and then edited to allow for the secrets templating that we used in the configuration file to work. Rather than editing the file directly (which would get overwritten in subsequent updates), we'll use systemd tools to do it properly. First, let's enable the service: | Authelia comes with a systemd service file that needs to be enabled and then edited to allow for the secrets templating that we used in the configuration file to work. Rather than editing the file directly (which would get overwritten in subsequent updates), we'll use systemd tools to do it properly. First, let's enable the service: | ||
| - | < | + | < |
| cd / | cd / | ||
| systemctl enable authelia.service | systemctl enable authelia.service | ||
| Line 300: | Line 326: | ||
| Your default cli text editor will open at this point. We'll need to put our modifications at the top, between the first and the second comment block. This is what to add: | Your default cli text editor will open at this point. We'll need to put our modifications at the top, between the first and the second comment block. This is what to add: | ||
| - | < | + | < |
| [Service] | [Service] | ||
| Environment=X_AUTHELIA_CONFIG_FILTERS=template | Environment=X_AUTHELIA_CONFIG_FILTERS=template | ||
| </ | </ | ||
| + | |||
| + | After you're done editing the override line, you can refresh systemd (not always necessary, but it doesn' | ||
| + | |||
| + | <code bash> | ||
| + | systemctl daemon-reload | ||
| + | systemctl restart authelia | ||
| + | </ | ||
| + | |||
| + | Authelia should be up and running now on port 9091, listening on localhost. | ||
| + | |||
| + | ===== Nginx configuration ===== | ||
| + | |||
| + | Now that Authelia is active, it's time to let it talk to the internet. Go to ''/ | ||
| + | |||
| + | <code bash> | ||
| + | cd / | ||
| + | nano authelia | ||
| + | </ | ||
| + | |||
| + | This is the content of the Nginx configuration file, with extra settings for ssl security: | ||
| + | |||
| + | <code nginx> | ||
| + | server { | ||
| + | listen 443 ssl; | ||
| + | listen [::]:443 ssl; | ||
| + | http2 on; | ||
| + | ssl_certificate | ||
| + | ssl_certificate_key / | ||
| + | server_name auth.mydomain.tld; | ||
| + | access_log / | ||
| + | error_log | ||
| + | |||
| + | ssl_protocols TLSv1.2 TLSv1.3; | ||
| + | ssl_ecdh_curve X25519MLKEM768: | ||
| + | ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256: | ||
| + | ssl_prefer_server_ciphers off; | ||
| + | | ||
| + | add_header Strict-Transport-Security " | ||
| + | add_header X-Content-Type-Options nosniff; | ||
| + | add_header X-XSS-Protection "1; mode=block"; | ||
| + | add_header X-Robots-Tag none; | ||
| + | add_header X-Download-Options noopen; | ||
| + | add_header X-Permitted-Cross-Domain-Policies none; | ||
| + | | ||
| + | set $upstream http:// | ||
| + | |||
| + | location / { | ||
| + | # Headers | ||
| + | proxy_set_header Host $host; | ||
| + | proxy_set_header X-Original-URL $scheme:// | ||
| + | proxy_set_header X-Forwarded-Proto $scheme; | ||
| + | proxy_set_header X-Forwarded-Host $host; | ||
| + | proxy_set_header X-Forwarded-URI $request_uri; | ||
| + | proxy_set_header X-Forwarded-Ssl on; | ||
| + | proxy_set_header X-Forwarded-For $remote_addr; | ||
| + | proxy_set_header X-Real-IP $remote_addr; | ||
| + | ## Basic Proxy Configuration | ||
| + | client_body_buffer_size 128k; | ||
| + | proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; ## Timeout if the real server is dead. | ||
| + | proxy_redirect | ||
| + | proxy_http_version 1.1; | ||
| + | proxy_cache_bypass $cookie_session; | ||
| + | proxy_no_cache $cookie_session; | ||
| + | proxy_buffers 64 256k; | ||
| + | # Trusted Proxies Configuration | ||
| + | real_ip_header X-Forwarded-For; | ||
| + | real_ip_recursive on; | ||
| + | # Advanced Proxy Configuration | ||
| + | send_timeout 5m; | ||
| + | proxy_read_timeout 360; | ||
| + | proxy_send_timeout 360; | ||
| + | proxy_connect_timeout 360; | ||
| + | proxy_pass $upstream; | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | After saving the file, you need to enable the configuration and restart the web server: | ||
| + | |||
| + | <code bash> | ||
| + | ln -s / | ||
| + | systemctl restart nginx | ||
| + | </ | ||
| + | |||
| + | Authelia should now be available at https:// | ||