欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

ubuntu 编译安装 nginx

程序员文章站 2022-06-05 16:34:41
...
更新源:apt-get update
升级软件:apt-get upgrade
更新系统: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
以上乱扯可能会用到
下载 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 和 openssl 都是下载的 文件解压后的路径)
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"
要启动nginx,直接执行/usr/local/nginx/sbin/nginx命令即可。一旦nginx启动后,便可以通过nginx加-s参数调用来控制它。使用的语法格式为:
nginx -s signal
其中signal可以为如下参数的一种:
* stop 快速关闭
* quit 优雅的关闭
* reload 重新加载配置文件
* reopen 重新打开log文件
修改PATH 变量 使 替换 #/usr/local/nginx/sbin/nginx # nginx
修改 /etc/profile 最后添加一行
export PATH=/usr/local/tengine/sbin:$PATH
//重启
source /etc/profile
添加开机启动
echo "/usr/local/tengine/sbin/nginx" >>/etc/rc.local

以上就介绍了ubuntu 编译安装 nginx,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。