Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Nginx Website Automation Scripts

Scripts for automating deployment and removal of websites using the Nginx web server.


🇺🇸 English

Overview

This repository contains shell scripts that simplify the deployment and removal of websites on an Nginx server.

They automate tasks such as:

  • Moving website files to /var/www
  • Creating and configuring Nginx server blocks
  • Enabling/disabling sites via sites-enabled
  • Reloading Nginx after changes
  • Safely removing site configurations and files

🚀 Deployment Script

deployNginxWebsite.sh

This script automates the deployment of a static or PHP website on an Nginx server.

It performs the following actions:

  • Moves the website directory to /var/www
  • Creates an Nginx configuration file
  • Creates a symbolic link in sites-enabled
  • Checks Nginx configuration
  • Restarts Nginx

Usage

  1. Make the script executable:
chmod +x deployNginxWebsite.sh
  1. Run the script with the path to the website folder:
sudo ./deployNginxWebsite.sh /path/to/website [-ip]

-ip (optional): serves the site using the server IP instead of a domain name Notes:

  • Ensure your domain (e.g. mywebsite) is properly configured in DNS or /etc/hosts
  • If using a different PHP version, update the PHP-FPM socket path (e.g. php8.0-fpm.sock)
  • Requires Nginx and PHP-FPM to be installed and configured

🗑️ Removal Script

removeNginxWebsite.sh

This script automates the removal of a website from an Nginx server.

It performs the following actions:

  • Removes Nginx config from sites-available and sites-enabled
  • Deletes the website directory from /var/www
  • Reloads Nginx to apply changes

Usage:

  1. Make the script executable:
chmod +x removeNginxWebsite.sh
  1. Run the script with the site name:
sudo ./removeNginxWebsite.sh example.com

Notes

  • Be careful: this action is irreversible
  • If config or directory is missing, the script will notify but continue execution Requires Nginx to be installed

🇷🇺 Русский

Описание

В этом репозитории представлены shell-скрипты для автоматизации развёртывания и удаления сайтов на сервере Nginx.

Они выполняют:

  • перенос сайта в /var/www
  • создание конфигурации Nginx
  • подключение сайта через sites-enabled
  • перезагрузку Nginx
  • безопасное удаление сайта и конфигурации

🚀 Скрипт деплоя deployNginxWebsite.sh

Скрипт автоматизирует развёртывание статического или PHP сайта на Nginx.

Что делает:

  • перемещает сайт в /var/www
  • создаёт конфиг Nginx
  • добавляет символическую ссылку в sites-enabled
  • проверяет конфигурацию Nginx
  • перезапускает сервер Использование:
chmod +x deployNginxWebsite.sh
sudo ./deployNginxWebsite.sh /путь/к/папке_с_сайтом [-ip]

-ip - (опционально) доступ по IP вместо домена Примечания:

  • убедитесь, что домен настроен в DNS или /etc/hosts
  • при использовании PHP проверьте версию PHP-FPM
  • требуется установленный Nginx и PHP-FPM

🗑️ Скрипт удаления ``removeNginxWebsite.sh`

Скрипт автоматизирует удаление сайта из Nginx.

Что делает:

  • удаляет конфиги из sites-available и sites-enabled
  • удаляет папку сайта из /var/www
  • перезагружает Nginx Использование:
chmod +x removeNginxWebsite.sh
sudo ./removeNginxWebsite.sh example.com

Примечания:

  • удаление необратимо
  • если файлы не найдены, скрипт продолжит работу
  • требуется установленный Nginx

About

Shell scripts for automating deployment and removal of websites using Nginx web server / SH скрипты для автоматизации деплоя/удаления сайта, используя веб-сервер nginx.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages