1. 下载nginx安装包
wget http://nginx.org/download/nginx-1.20.2.tar.gz
2. 安装依赖包
apt-get install make
apt-get install gcc g++
apt-get install libpcre3 libpcre3-dev
apt-get install zlib1g zlib1g-dev
apt-get install openssl libssl-dev
3.解压,编译安装
tar -xvf nginx-1.20.2.tar.gz
cd nginx-1.20.2
./configur --with-http_ssl_module
make && make install
4. 启动nginx,测试
cd /usr/local/nginx/
./sbin/nginx
ps -ef | grep nginx
curl http://127.0.0.1
5.结果:
root@60b97cab767c:/usr/local/nginx# curl http://127.0.0.1
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
|