commit 40e5024402fb44145c3c0dc6b2d54c2bc6c836c6 Author: jmsgrogan Date: Wed Mar 13 09:09:02 2024 +0000 Add server setup basics diff --git a/basic_serverblock.txt b/basic_serverblock.txt new file mode 100644 index 0000000..738f918 --- /dev/null +++ b/basic_serverblock.txt @@ -0,0 +1,15 @@ + + +server { + listen 80; + listen [::]:80; + + root /var/www/your_domain/html; + index index.html index.htm index.nginx-debian.html; + + server_name your_domain www.your_domain; + + location / { + try_files $uri $uri/ =404; + } +} diff --git a/setup_basic_nginx.sh b/setup_basic_nginx.sh new file mode 100644 index 0000000..33846bf --- /dev/null +++ b/setup_basic_nginx.sh @@ -0,0 +1,16 @@ +apt install nginx + +ufw allow 'Nginx HTTP' + +mkdir -p /var/www/your_domain/html +chown -R $USER:$USER /var/www/your_domain/html +chmod -R 755 /var/www/your_domain + +echo "Hello world" | /var/www/your_domain/html/index.html + +cp basic_serverblock.txt /etc/nginx/sites-available/your_domain + +ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/ + +# sudo nano /etc/nginx/nginx.conf +server_names_hash_bucket_size 64; \ No newline at end of file diff --git a/setup_machine.sh b/setup_machine.sh new file mode 100644 index 0000000..0278354 --- /dev/null +++ b/setup_machine.sh @@ -0,0 +1,23 @@ +export MY_USER="my_user" + +# Create non-root user +adduser $MY_USER +usermod -aG sudo $MY_USER + +# Set up firewall +ufw allow OpenSSH +ufw enable + +# Disable ssh password login +# sudo nano /etc/ssh/sshd_config +# PermitRootLogin no +# PasswordAuthentication no +# ChallengeResponseAuthentication no +# UsePAM no +# sudo systemctl restart ssh + +# Enable ssh login +rsync --archive --chown=$MY_USER:$MY_USER ~/.ssh /home/$MY_USER + +# Fail2ban for SSH +apt install fail2ban \ No newline at end of file