Manage Apache configuration files with Git
Ubuntu's Apache configuration file is easy to manage with Git, so let's manage it with Git. prize.
cd / etc / apache2
Initialize Git repository
Use " git init" to initialize it as a Git repository.
sudo git init
Creating .gitignore
conf-enabled, mods-enabled, sites-enabled are configuration files that are enabled for each environment, so Use .gitignore to remove it from Git management. Edit with the vi command.
sudo vi .gitignore
Describe the following settings. Now conf-enabled, mods-enabled, sites-enabled are no longer managed by Git.
* -enable
Tips on how to manage
It is recommended to leave apache2.conf, envvars, magic, ports.conf untouched by default.
Let's include all the configuration files in the development environment and the production environment in xxx-available.
Put it in the staging environment
Next, use the "git add command" to put the files you want to manage into the staging environment. Specify "." To put all the files under the current directory in the staging environment.
sudo git add.
Let's check the file in the staging environment with the "git status command".
sudo git status
If you make a mistake, use "git reset" to restore it.
sudo git reset
If properly staged, it's finally a commit.
sudo git commit -m "first commit"
Push to a remote repository such as Github. Importing from the remote repository and reflecting it in the remote repository will be handled in another location.