您的位置:首页 > 运维架构 > Nginx

ubuntu 编译安装 nginx

2015-01-12 15:42 399 查看
更新源: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

udo apt-get install build-essential

configure: error: You need a C++ compiler for C++ support.

以上乱扯可能会用到

下载 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: