From 76be9604e3ba1ed6e0bf8e09db50401d7091fb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Colombaro?= Date: Fri, 1 Feb 2019 15:49:09 +0100 Subject: [PATCH] Reflect conf.d change is doc --- doc/sites-available.md | 17 ------------ doc/sites-enabled.md | 39 -------------------------- doc/usage.md | 62 ++++++++++++++++++++++++++++++------------ 3 files changed, 45 insertions(+), 73 deletions(-) delete mode 100644 doc/sites-available.md delete mode 100644 doc/sites-enabled.md diff --git a/doc/sites-available.md b/doc/sites-available.md deleted file mode 100644 index 4dcc062..0000000 --- a/doc/sites-available.md +++ /dev/null @@ -1,17 +0,0 @@ -[Nginx Server Configs homepage](https://github.com/h5bp/server-configs-nginx) - | [Documentation table of contents](TOC.md) - -# Sites available - -Files in this folder are not referenced/loaded automatically. The intended -purpose of this folder is to contain all server config files whether they -are currently in use or not. - -So, for example this folder may contain: - - example.com - example.com-original - otherdomain.com - newproject.com - -Where each file contains the server block(s) specific to that project. diff --git a/doc/sites-enabled.md b/doc/sites-enabled.md deleted file mode 100644 index dce120a..0000000 --- a/doc/sites-enabled.md +++ /dev/null @@ -1,39 +0,0 @@ -[Nginx Server Configs homepage](https://github.com/h5bp/server-configs-nginx) - | [Documentation table of contents](TOC.md) - -# Sites enabled - -Files in this folder **are** loaded automatically. The intended purpose of -this folder is to contain symlinks to the folder `sites-available`. - -## Enabling a new site - -To enable a new site, link the config file to sites-enabled, and restart nginx. - -For example: - - $ cd /etc/nginx/sites-available - - ... create newproject.com ... - - $ cd /etc/nginx/sites-enabled - $ ln -s ../sites-available/newproject.com . - - $ /etc/init.d/nginx reload - [....] Reloading nginx configuration: nginx. - $ - -## Disabling a site - -To disable a site, remove the symlink from the sites-enabled folder, and restart -nginx. - -For example: - - $ cd /etc/nginx/sites-enabled - $ rm newproject.com - - $ /etc/init.d/nginx reload - [....] Reloading nginx configuration: nginx. - $ - diff --git a/doc/usage.md b/doc/usage.md index 9d03dd8..405e12e 100644 --- a/doc/usage.md +++ b/doc/usage.md @@ -36,19 +36,18 @@ for a description of the required steps. ## Basic structure -This repository has the following structure, which is based on the standard install for a -webserver on debian: +This repository has the following structure: ``` -. -├── doc -├── h5bp - ├── basic.conf - ├── location - └── ... -├── sites-available - └── example.com -├── sites-enabled +./ +├── doc/ +├── conf.d/ +│ ├── default.conf +│ └── templates/ +├── h5bp/ +│ ├── basic.conf +│ ├── location/ +│ └── ... ├── mime.types └── nginx.conf ``` @@ -73,15 +72,44 @@ access. Files in this folder contain one or more location directives. They are intended to be loaded in the server context (or, in a nested location block). -### sites-available +### conf.d -This directory should contain all of the server definitions that are available -for use. [About sites-available](sites-available.md). +This directory should contain all of the server definitions. -### sites-enabled +Except if they are dot prefixed or non .conf extension, all files in this +folder **are** loaded automatically. -This directory should contain only symlinks to enable a specific `sites-available` -server. [About sites-enabled](sites-enabled.md). +* `templates` folder + +Files in this folder contain a server{} template for secure and non-secure hosts. +They are intended to be copied in the `conf.d` folder with all `example.com` +occurrences changed to the target host. + +#### Usage + +```bash +$ cd /etc/nginx/conf.d +``` + +* Creating a new site + ```bash + $ cp templates/example.com.conf actual-hostname.conf + $ sed -i 's/example.com/actual-hostname/g' actual-hostname.conf + ``` + +* Enabling a site + ```bash + $ mv .actual-hostname.conf actual-hostname.conf + ``` + +* Disabling a site + ```bash + $ mv actual-hostname.conf .actual-hostname.conf + ``` + +```bash +$ /etc/init.d/nginx reload +``` ### mime.types