Home >Backend Development >PHP Tutorial >Compile and install nginx on ubuntu
Update source: apt-get update
Upgrade software: apt-get upgrade
Update system: apt-get dist-upgrade
apt-get install openssl
apt-get install libssl-dev
yum -y install openssl openssl-devel
groupadd www-data
useradd -g www-data www-data
The above nonsense may be used
download zlib pcre openssl
./configure --prefix=/usr/local/tengine --user=www-data --group =www-data --with-zlib=/home/zlib-1.2.8 --with-pcre=/home/pcre-8.36 --with-openssl=/home/openssl-1.0.1k
(zlib pcre here and openssl are the path after decompression of the downloaded file)
Configuration summary
+ using PCRE library: /home/pcre-8.36
+ using OpenSSL library: /home/openssl-1.0.1k
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using zlib library: /home/zlib-1.2.8
+ jemalloc library is disabled
nginx path prefix: "/usr/local/tengine"
nginx binary file: "/usr/local/tengine /sbin/nginx"
nginx configuration prefix: "/usr/local/tengine/conf"
nginx configuration file: "/usr/local/tengine/conf/nginx.conf"
nginx pid file: "/usr/local/ tengine/logs/nginx.pid"
nginx error log file: "/usr/local/tengine/logs/error.log"
nginx http access log file: "/usr/local/tengine/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx dso module path: "/usr/local/tengine/modules/"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
To start nginx, just execute the /usr/local/nginx/sbin/nginx command. Once nginx is started, it can be controlled by calling nginx with the -s parameter. The syntax format used is:
nginx -s signal
where signal can be one of the following parameters:
* stop fast shutdown
* quit graceful shutdown
* reload reload the configuration file
* reopen reopen the log file
modify PATH Variable Use replace #/usr/local/nginx/sbin/nginx # nginx
Modify/etc/profile Finally add a line
export PATH=/usr/local/tengine/sbin:$PATH
//Restart
source /etc/profile
Add boot startup
echo "/usr/local/tengine/sbin/nginx" >>/etc/rc.local
The above introduces the compilation and installation of nginx on ubuntu, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.