注
※依赖库:
PCRE
OpenSSL
Zlib
jemalloc
※安装方式:
Linux下解压,执行:
./configure
make
make install
一、库文件
tar -jxvfjemalloc-3.6.0.tar.bz2 -C /usr/local/src
sudo apt-get installopenssl libssl-dev
tar -jxvfpcre-8.36.tar.bz2 -C /usr/local/src
tar -xvfzlib-1.2.8.tar.gz -C /usr/local/src
wgethttp://tengine.taobao.org/download/tengine-2.1.0.tar.gz
tar -zxvftengine-2.1.0.tar.gz
cd tengine-2.1.0
二、tengine-2.1.0安装
在tengine-2.1.0根目录下执行:
./configure --prefix=/usr/local/nginx --with-pcre=/usr/local/src/pcre-8.36--with-jemalloc=/usr/local/src/jemalloc-3.6.0 --with-http_gzip_static_module--with-http_realip_module --with-http_stub_status_module--with-http_concat_module --with-zlib=/usr/local/src/zlib-1.2.8 --user=elvis --group=elvis
’--user=elvis --group=elvis‘ 可不写
注意配置的时候–with-pcre、–with-openssl、–with-jemalloc、–with-zlib的路径为源文件的路径
make
make install
三、配置
打开nginx.conf配置文件后,最基础的需要做以下几个地方的修改(/usr/local/nginx/conf/nginx.conf)
[html] view plain copy
- --user=elvis
- #自动以CPU核心数启动相应数量的进程
- worker_processes auto;
- #全局的错误日志地址,方便调试
- error_log/home/jason/BigDisk/nginx/error.log;
- #开启gzip支持
- gzip on
- server {
- #设置默认访问的server(default是指通过ip或者servername未定义的域名进行访问时就走到这个server)
- listen 80 default;
- #默认访问的路径
- root /home/jason/Work/nginx-default;
- location / {
- index index.php index.html index.htm;
- }
- #默认错误页面
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- #抓发到php-fpm
- location ~ \.php$ {
- fastcgi_pass unix:/var/run/php-fpm.socket;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- include fastcgi_params;
- }
- }
#引用其他的vhost配置文件
include vhost/*.conf;四、启动
wget --no-check-certificate 'http://raw.github.com/JasonGiedymin/nginx-init-ubuntu/master/nginx'-O /etc/init.d/nginx
chmod 777/etc/init.d/nginx
/etc/init.d/nginxstart
浏览器输入主机ip即可访问
中途出现问题,随时可以来问我。
本文暂时没有评论,来添加一个吧(●'◡'●)