Ubuntu installation Nginx

Source: Internet
Author: User
Tags install openssl openssl

Nginx ("Engine X") is a high-performance HTTP and reverse proxy server, also a IMAP/POP3/SMTP proxy server. Nginx was developed by Igor Sysoev for the second rambler.ru site of Russian traffic, and the first public version 0.1.0 was released on October 4, 2004. It publishes the source code in the form of a BSD license, which is known for its stability, rich feature set, sample configuration files, and consumption of low system resources.

Installing the Nginx dependent Library installing GCC g++ dependent libraries

The Ubuntu platform can use the following commands.

12 apt-get install build-essentialapt-get install libtool

The Centeros platform can use the following commands.

123456 centos平台编译环境使用如下指令安装make:yum -y install gcc automake autoconf libtool make安装g++:yum install gcc gcc-c++  
Installing Pcre dependent libraries (http://www.pcre.org/)
12 sudo apt-get updatesudo apt-get install libpcre3 libpcre3-dev
Installing Zlib dependent libraries (http://www.zlib.net)
1 apt-get install zlib1g-dev
Installing SSL Dependent libraries
1 apt-get install openssl
Installing Nginx (http://nginx.org)
12345678910111213141516171819 #下载最新版本:wget http://nginx.org/download/nginx-1.11.3.tar.gz#解压:tar -zxvf nginx-1.11.3.tar.gz#进入解压目录:cd nginx-1.11.3#配置:./configure --prefix=/usr/local/nginx #编辑nginx:make注意:这里可能会报错,提示“pcre.h No such file or directory”,具体详见:http://stackoverflow.com/questions/22555561/error-building-fatal-error-pcre-h-no-such-file-or-directory需要安装 libpcre3-dev,命令为:sudo apt-get install libpcre3-dev#安装nginx:sudo make install#启动nginx:sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf注意:-c 指定配置文件的路径,不加的话,nginx会自动加载默认路径的配置文件,可以通过 -h查看帮助命令。#查看nginx进程:ps -ef|grep nginx
Nginx Common command to start Nginx
123 /usr/local/nginx/sbin/nginx./sbin/nginx 
Stop Nginx
123 ./sbin/nginx -s stop./sbin/nginx -s quit
-S is the way to send a signal to Nginx. Nginx Reload Configuration
1 ./sbin/nginx -s reload
Specify the configuration file
1 ./sbin/nginx -c /usr/local/nginx/conf/nginx.conf
-C for configuration, specify the config file View Nginx version There are two parameters to view Nginx version information. The first of these is as follows:
123 ./sbin/nginx -vnginx: nginx version: nginx/1.0.0
Another type of display is the detailed version information:
12345 [email protected]:/usr/local/nginx$ ./sbin/nginx -Vnginx: nginx version: nginx/1.0.0nginx: built bygcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4)nginx: TLS SNI support enablednginx: configure arguments: --with-http_ssl_module --with-openssl=/home/luming/openssl-1.0.0d/
Check that the configuration file is correct
12345 [email protected]:/usr/local/nginx$./sbin/nginx-t nginx: [Alert] could not open error log file:open ()   "/usr/local/nginx/logs/error.log"   failed (13 : Permission denied) nginx:the configuration file/usr/local/nginx/conf/nginx.conf syntax  is   ok 2012/01/09 16:45:09 [Emerg] 23898#0:open ()   "/usr/local/ Nginx/logs/nginx.pid "   failed (13:permission denied) nginx:configuration file/usr/local/nginx/conf/nginx.conf test failed
If you see a message like above indicating that there is no access to the error log file and process, you can sudo (super user do):
123 [email protected]:/usr/local/nginx$ sudo ./sbin/nginx -tnginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax isoknginx: configuration file /usr/local/nginx/conf/nginx.conf test issuccessful
If shown above, the configuration file is correct. Otherwise, there will be hints. Display Help information
1 [email protected]:/user/local/nginx$ ./sbin/nginx -h

Or:

1 [email protected]:/user/local/nginx$ ./sbin/nginx -?

Ubuntu installation Nginx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.