-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add nginx deployment workflow and configuration
- Loading branch information
Showing
2 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: Deploy Nginx Configuration | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - 'nginx_securefit.conf' | ||
| - '.github/workflows/nginx-deploy.yml' | ||
|
|
||
| jobs: | ||
| deploy-nginx: | ||
| runs-on: self-hosted | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Deploy nginx configuration | ||
| run: | | ||
| sudo cp -v ./nginx_securefit.conf /etc/nginx/conf.d/nginx_securefit.conf | ||
| sudo nginx -t | ||
| sudo systemctl reload nginx | ||
| - name: Verify nginx configuration | ||
| run: | | ||
| curl -I http://localhost | ||
| sudo systemctl status nginx |
This file contains 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,10 +1,16 @@ | ||
| server { | ||
| listen 80 default_server; | ||
| server_name localhost; | ||
| listen 80; | ||
| server_name tdt4242-26.idi.ntnu.no; | ||
|
|
||
| location / { | ||
| return 200 "Nginx configuration deployed successfully!"; | ||
| add_header Content-Type text/plain; | ||
| root /var/www/html; | ||
| index index.html; | ||
| try_files $uri $uri/ =404; | ||
| } | ||
|
|
||
| # Add some basic security headers | ||
| add_header X-Frame-Options "SAMEORIGIN"; | ||
| add_header X-XSS-Protection "1; mode=block"; | ||
| add_header X-Content-Type-Options "nosniff"; | ||
| } | ||
|
|