- 
                Notifications
    You must be signed in to change notification settings 
- Fork 796
Use Nginx config with outlets #913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            2 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,2 +1,6 @@ | ||
| # This file is deprecated; you can remove it from your app.yml | ||
| # TODO(2026-01-01): Remove this file | ||
| run: | ||
| - exec: |- | ||
| echo "Deprecation warning: sshd is no longer supported" | ||
| echo "Remove templates/sshd.template.yml from your containers/*.yml files" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,8 +1,6 @@ | ||
| # This file is deprecated; you can remove it from your app.yml | ||
| # TODO(2026-01-01): Remove this file | ||
| run: | ||
| - exec: echo "Enabling IPv6 listener" | ||
| - replace: | ||
| filename: "/etc/nginx/conf.d/discourse.conf" | ||
| from: listen 80; | ||
| to: | | ||
| listen 80; | ||
| listen [::]:80; | ||
| - exec: |- | ||
| echo "Deprecation warning: IPv6 is enabled by default when possible" | ||
| echo "Remove templates/web.ipv6.template.yml from your containers/*.yml files" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,56 +1,46 @@ | ||
| run: | ||
| - exec: | ||
| cmd: | ||
| - "mkdir -p /shared/ssl/" | ||
| - replace: | ||
| filename: "/etc/nginx/conf.d/discourse.conf" | ||
| from: /listen 80;\s+listen \[::\]:80;/m | ||
| to: | | ||
| listen 443 ssl; | ||
| listen [::]:443 ssl; | ||
| http2 on; | ||
| SSL_TEMPLATE_SSL_BLOCK | ||
| - replace: | ||
| filename: "/etc/nginx/conf.d/discourse.conf" | ||
| from: /listen 80;/ | ||
| to: | | ||
| listen 443 ssl; | ||
| http2 on; | ||
| SSL_TEMPLATE_SSL_BLOCK | ||
| - replace: | ||
| hook: ssl | ||
| filename: "/etc/nginx/conf.d/discourse.conf" | ||
| from: /SSL_TEMPLATE_SSL_BLOCK/ | ||
| to: | | ||
| cmd: | ||
| - "mkdir -p /shared/ssl/" | ||
| - file: | ||
| path: "/etc/nginx/conf.d/outlets/before-server/10-redirect-http-to-https.conf" | ||
| contents: | | ||
| server { | ||
| listen 80; | ||
| return 301 https://$$ENV_DISCOURSE_HOSTNAME$request_uri; | ||
| } | ||
| - exec: rm /etc/nginx/conf.d/outlets/server/10-http.conf | ||
| - file: | ||
| hook: ssl | ||
| path: "/etc/nginx/conf.d/outlets/server/20-https.conf" | ||
| contents: | | ||
| listen 443 ssl; | ||
| http2 on; | ||
|  | ||
| ssl_protocols TLSv1.2 TLSv1.3; | ||
| ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; | ||
| ssl_prefer_server_ciphers off; | ||
| ssl_protocols TLSv1.2 TLSv1.3; | ||
| ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; | ||
| ssl_prefer_server_ciphers off; | ||
|  | ||
| ssl_certificate /shared/ssl/ssl.crt; | ||
| ssl_certificate_key /shared/ssl/ssl.key; | ||
| ssl_certificate /shared/ssl/ssl.crt; | ||
| ssl_certificate_key /shared/ssl/ssl.key; | ||
|  | ||
| ssl_session_tickets off; | ||
| ssl_session_timeout 1d; | ||
| ssl_session_cache shared:SSL:1m; | ||
| ssl_session_tickets off; | ||
| ssl_session_timeout 1d; | ||
| ssl_session_cache shared:SSL:1m; | ||
|  | ||
| add_header Strict-Transport-Security 'max-age=31536000'; # remember the certificate for a year and automatically connect to HTTPS for this domain | ||
| add_header Strict-Transport-Security 'max-age=31536000'; | ||
|  | ||
| if ($http_host != $$ENV_DISCOURSE_HOSTNAME) { | ||
| if ($http_host != $$ENV_DISCOURSE_HOSTNAME) { | ||
| rewrite (.*) https://$$ENV_DISCOURSE_HOSTNAME$1 permanent; | ||
| } | ||
| - replace: | ||
| filename: "/etc/nginx/conf.d/discourse.conf" | ||
| from: "location @discourse {" | ||
| to: | | ||
| location @discourse { | ||
| add_header Strict-Transport-Security 'max-age=31536000'; # remember the certificate for a year and automatically connect to HTTPS for this domain | ||
| - replace: | ||
| filename: "/etc/nginx/conf.d/discourse.conf" | ||
| from: /server.+{/ | ||
| to: | | ||
| server { | ||
| listen 80; | ||
| return 301 https://$$ENV_DISCOURSE_HOSTNAME$request_uri; | ||
| } | ||
| server { | ||
| } | ||
| - file: | ||
| path: "/etc/nginx/conf.d/outlets/discourse/20-https.conf" | ||
| contents: | | ||
| add_header Strict-Transport-Security 'max-age=31536000'; | ||
| - exec: | ||
| cmd: | ||
| - |- | ||
| if [ -f "/proc/net/if_inet6" ] ; then | ||
| sed -i 's/listen 80;/listen 80;\nlisten [::]:80;/g' /etc/nginx/conf.d/outlets/before-server/10-redirect-http-to-https.conf | ||
| sed -i 's/listen 443 ssl;/listen 443 ssl;\nlisten [::]:443 ssl;/g' /etc/nginx/conf.d/outlets/server/20-https.conf | ||
| fi | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.