nginx@ubuntu:/usr/local/nginx/nginx-1.21.0$ ./configure
nginx@ubuntu:/usr/local/nginx/nginx-1.21.0$ make
nginx@ubuntu:/usr/local/nginx/nginx-1.21.0$ make install
curl http://localhost
<!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>
8、使用nginx 命令
# 提示命令不存在
root@ubuntu:/usr/local/nginx# nginx -t
Command 'nginx' not found, but can be installed with:
# 添加环境变量
root@ubuntu:/usr/local/nginx# vim /etc/profile
# 在最后追加
NGINX_HOME=/usr/local/nginx/sbin
export PATH=$NGINX_HOME:$PATH
# source /etc/profile 使配置文件立即生效
root@ubuntu:/usr/local/nginx# source /etc/profile
# 成功
root@ubuntu:/usr/local/nginx# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful