h5bp/server-configs-nginx
Fork: 1518 Star: 10684 (更新于 1970-01-01 00:00:00)
license: MIT
Nginx HTTP server boilerplate configs
最后发布版本: 5.0.1 ( 2023-07-23 18:07:57)
Nginx Server Configs
Nginx Server Configs is a collection of configuration files that can help your server improve the website's performance and security, while also ensuring that resources are served with the correct content-type and are accessible, if needed, even cross-domain.
Getting Started
Using the Nginx server configs repo directly has a few required steps to be able to work.
Check nginx.conf
settings
The first thing to check is that the nginx.conf
file contains appropriate values for
your specific install.
Most specific variables are:
-
user
-
error_log
-
pid
-
access_log
Nginx test and restart
-
To verify Nginx config
nginx -t
-
To verify Nginx config with a custom file
nginx -t -c nginx.conf
-
To reload Nginx and apply the new config
nginx -s reload
Repository structure
This repository has the following structure:
./
├── conf.d/
│ ├── default.conf
│ └── templates/
├── h5bp/
│ ├── basic.conf
│ ├── location/
│ └── .../
├── custom.d/
│ └── .../
├── mime.types
└── nginx.conf
-
conf.d/
This directory should contain all the
server
definitions.Except if they are dot prefixed or non
.conf
extension, all files in this directory are loaded automatically.-
templates
folderFiles in this directory contain a
server
template for secure and non-secure hosts. They are intended to be copied in theconf.d
directory with allexample.com
occurrences changed to the target host.
-
-
h5bp/
This directory contains config snippets (mixins) to be included as desired.
There are two types of config files provided: individual config snippets and combined config files which provide convenient defaults.
-
basic.conf
This file loads a small subset of the rules provided by this repository to add
expires
headers, allow cross-domain fonts and protect system files from web access. Thebasic.conf
file includes the rules which are recommended to always be defined. -
location/
Files in this directory contain one or more
location
directives. They are intended to be loaded in theserver
context (or, in a nestedlocation
block).
-
-
custom.d/
This directory should contain all the custom
nginx.conf
configuration.Except if they are dot prefixed or non
.conf
extension, all files in this folder are loaded automatically. -
mime.types
The
mime.types
file is responsible for mapping file extensions to MIME types. -
nginx.conf
The main Nginx config file.
Usage
As a reference
To use as reference requires no special installation steps, download/checkout the repository to a convenient location and adapt your existing Nginx configuration incorporating the desired functionality from this repository.
Download the latest release archive.
Directly
To use directly, replace the Nginx config directory with this repository. For example:
nginx -s stop
cd /etc
mv nginx nginx-previous
git clone https://github.com/h5bp/server-configs-nginx.git nginx
# install-specific edits
nginx
Manage sites
cd /etc/nginx/conf.d
-
Creating a new site
cp templates/example.com.conf .actual-hostname.conf sed -i 's/example.com/actual-hostname/g' .actual-hostname.conf
-
Enabling a site
mv .actual-hostname.conf actual-hostname.conf
-
Disabling a site
mv actual-hostname.conf .actual-hostname.conf
nginx -s reload
Support
- Nginx v1.8.0+
Contributing
Anyone is welcome to contribute, however, if you decide to get involved, please take a moment to review the guidelines:
Acknowledgements
Nginx Server Configs is only possible thanks to all the awesome contributors!
License
The code is available under the MIT license.
最近版本更新:(数据更新于 1970-01-01 00:00:00)
2023-07-23 18:07:57 5.0.1
2022-12-06 03:21:44 5.0.0
2022-02-25 04:39:19 4.2.0
2021-10-28 18:43:17 4.1.0
2021-08-01 01:22:26 4.0.0
2021-01-05 22:00:14 3.3.0
2020-04-14 16:25:51 3.2.0
2019-05-20 05:05:35 3.1.0
2019-03-09 22:21:49 3.0.1
2019-02-13 00:03:48 3.0.0
主题(topics):
best-practices, config, h5bp, nginx, nginx-configuration, robust, standard
h5bp/server-configs-nginx同语言 最近更新仓库
2024-11-22 09:02:37 BlackTeaPie/Course-of-Temptation-Chinese-Localization
2024-11-22 06:41:42 Loyalsoldier/clash-rules
2024-11-20 01:35:09 Qubic-Solutions/rqiner-builds
2024-11-18 20:23:06 JeoJay127/RapidEFI-Tool
2024-11-17 07:02:34 metatube-community/metatube-server-releases
2024-11-15 23:42:05 DustinWin/clash_singbox-tools