Happy Path: Setup Tengine(Nginx) on Linux VM
pre-requisite:
- has a runable CentOS7 system
- the Linux system a static IP address
My local setup
- OS: Windows 10
- VM: VMware WorkStation 15
- Linux: CentOS 7.6
What is Tengine
It is based on the Nginx HTTP server and has many advanced features. Tengine has proven to be very stable and efficient on some of the top 100 websites in the world, including taobao.com and tmall.com.
Setup Steps
- download the lastest released version in this link.
- upload the downloaded tar to linux under
~
directory- I personally use xftp
tar -zxvf tengine-x.x.x
cd tengine-x.x.x
yum install -y gcc openssl-devel pcre-devel zlib-devel
./configure --prefix=/usr/local/tengine
make && make install
cd /usr/local/tengine
cd sbin
./nginx
- verify nginx is started
- open browser in windows, input the ip address of vm
ps -ef | grep nginx
- there is no good way to shut down nginx process started in this way
kill -9 <process from above step>
- then let’s make nginx as a service which can be start/stop in a elegant way
cd /etc/init.d/
vi nginx
- copy the content from this file to nginx file
chmod 777 nginx
service nginx start
FAQ
- why I can see nginx process running, but cannot reach linux ip through Windows browser
- possibly because the firewall is opened, can disable it to avoid same issue
- solution
systemctl stop firewalld
systemctl disable firewalld
- when run
service nginx start
terminal get stuck- open another terminalconnecting to same linux vm
service nginx status
- get this error:
PID file /var/run/nginx.pid not readable
- solutions
vi /usr/local/tengine/conf/nginx.conf
- add one more line
pid /var/run/nginx.pid;
- source
/usr/local/tengine/conf/nginx.conf
service nginx start
- get this error: