linux_wiki:nginx_http_server

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux_wiki:nginx_http_server [2016/04/13 23:25]
billdozor [Configuration]
linux_wiki:nginx_http_server [2019/05/25 23:50]
Line 1: Line 1:
-====== Nginx HTTP Server ====== 
  
-**General Information** 
- 
-Installation and configuration of Nginx web server.  
- 
-**Checklist** 
-  * Distro(s): Enterprise Linux 6/7 
- 
----- 
- 
-====== Installation ====== 
- 
-Installation of Nginx can be completed via repo (Official Nginx, EPEL, or Software Collections) or compiling. 
- 
-===== Repo: Official Nginx ===== 
- 
-[[http://nginx.org/en/linux_packages.html|Nginx.org]] has pre-built packages. You can select mainline (newer) or stable. 
- 
-Versions as of 04/13/2016: 
-  * Mainline: 1.9.14 
-  * Stable: 1.8.1 
-  * Legacy: 1.6.3 and below 
- 
-  - Add a nginx repo file 
-    * Stable Repo:<code bash>vim /etc/yum.repos.d/nginx.repo 
-[nginx] 
-name=nginx repo 
-baseurl=http://nginx.org/packages/centos/7/$basearch/ 
-gpgcheck=0 
-enabled=1</code> 
-    * Mainline Repo:<code bash>vim /etc/yum.repos.d/nginx.repo 
-[nginx] 
-name=nginx repo 
-baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/ 
-gpgcheck=0 
-enabled=1</code> 
-  - Install<code bash>yum install nginx</code> 
- 
-===== Repo: EPEL ===== 
- 
-Versions as of 04/13/2016 
-  * CentOS 7.2: Nginx 1.6.3 
- 
-Procedure 
-  * Install the [[linux_wiki:repos#epel|EPEL repo]] 
-  * Install Nginx<code bash>yum install nginx</code> 
- 
-===== Repo: Software Collections ===== 
- 
-Versions as of 04/13/2016: 
-  * nginx 1.4 (legacy) 
-  * nginx 1.6 (legacy) 
-  * nginx 1.8 (stable) 
- 
-  - Add the [[linux_wiki:repos#software_collections|software collections repo]]. 
-  - Install<code bash>yum install rh-nginx18</code> 
-  - Enable the software collection<code bash>scl enable rh-nginx18 bash</code> 
-    - Run signal commands (nginx -s signal) as normal from the Operation section below 
-===== Compile and Install ===== 
- 
-Building from source is usually done for specific functionality and is more time consuming. 
- 
-  - Install pre-reqs<code bash>yum install gcc pcre-devel zlib-devel</code> 
-  - [[http://nginx.org/en/download.html|Download]] a tarball (Example: Stable)<code bash>wget http://nginx.org/download/nginx-1.8.1.tar.gz</code> 
-  - Unarchive/unpack<code bash>tar -zxvf nginx-1.8.1.tar.gz</code> 
-  - Change into directory<code bash>cd nginx-1.8.1/</code> 
-  - Configure nginx<code bash>./configure --prefix=/usr/local/nginx</code> 
-    - Available configuration options: http://nginx.org/en/docs/configure.html 
-  - Compile<code bash>make</code> 
-  - Install<code bash>make install</code> 
- 
----- 
- 
-====== Configuration ====== 
- 
-  * Main Config: /etc/nginx/nginx.conf 
-    * Alt Main (Compiled): /usr/local/nginx/conf/nginx.conf 
-    * Alt Main (Software Collections): /etc/opt/rh/rh-nginx18/nginx/nginx.conf 
-  * Additional Config: /etc/nginx/conf.d/ 
-    * Alt Additional Config (Compiled): No default 
-    * Alt Additional Config (Software Collections): /etc/opt/rh/rh-nginx18/nginx/conf.d/ 
- 
----- 
- 
-====== Operation ====== 
- 
-Controlling the nginx web server. 
- 
-Nginx can be controlled via the system's service commands or nginx executable signals. 
- 
-  * Main nginx executable: /usr/sbin/nginx 
-    * Alt main nginx executable (Compiled): /usr/local/nginx/sbin/nginx 
- 
----- 
- 
-==== Enable on Boot ==== 
- 
-  * Autostart the nginx web server upon system startup 
-<code bash>systemctl enable nginx</code> 
- 
----- 
- 
-==== Start ==== 
- 
-  * Evaluate config files; if syntax is ok, start 
-<code bash>systemctl start nginx</code> 
-or 
-<code bash>nginx</code> 
- 
----- 
- 
-==== Stop ==== 
- 
-  * Stop the nginx processes now 
-  * Kills current sessions 
-<code bash>systemctl stop nginx</code> 
-or 
-<code bash>nginx -s stop</code> 
- 
----- 
- 
-==== Reload Config ==== 
- 
-  * Equivalent to Apache httpd's "graceful" restart 
-  * Check syntax 
-    * if ok, then spawn new workers with new config and signal old workers to shutdown after current requests are complete 
-    * if NOT ok, continue using old configuration 
-<code bash>systemctl reload nginx</code> 
-or 
-<code bash>nginx -s reload</code> 
- 
----- 
- 
-==== Restart ==== 
- 
-  * Kill worker processes immediately 
-<code bash>systemctl restart nginx</code> 
- 
----- 
- 
-==== Graceful Stop ==== 
- 
-  * Equivalent to Apache httpd's "graceful-stop" 
-  * Wait for worker processes to finish serving current requests, then stop. 
-  * Do not accept new requests 
-<code bash>nginx -s quit</code> 
- 
----- 
  • linux_wiki/nginx_http_server.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)