Skip to content

Commit

Permalink
Add nginx deployment workflow and configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
haahauge committed Apr 2, 2025
1 parent a26344c commit 87d5410
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/nginx-deploy.yml
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
14 changes: 10 additions & 4 deletions nginx_securefit.conf
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";
}

0 comments on commit 87d5410

Please sign in to comment.