nginx 安装与简单设置

安装

$ tar xvfz nginx-1.0.0.tar.gz 

$ cd nginx-1.0.0/

$ sudo ./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/tmp/nginx/client/  --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --user=nginx  --group=nginx > ~/nginx_install

 
  
$ sudo ./ configure --prefix =/ usr / local / nginx
--sbin-
path =/ usr / sbin / nginx
--conf-
path =/ etc / nginx / nginx . conf
--error-log-
path =/ var / log / nginx / error . log
--pid-
path =/ var / run / nginx / nginx . pid
--lock-
path =/ var / lock / nginx . lock
--with-http_ssl_module
--with-http_flv_module
--with-http_gzip_static_module
--http-log-
path =/ var / log / nginx / access . log
--http-client-body-temp-
path =/ var / tmp / nginx / client /
--http-proxy-temp-
path =/ var / tmp / nginx / proxy /
--http-fastcgi-temp-
path =/ var / tmp / nginx / fcgi /
--user
= nginx
--group
= nginx
> ~ / nginx_install

$ sudo make

$ sudo make install

编译参数: http://wiki.nginx.org/NginxChsInstallOptions

 
  
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1 library is not used
+ using system zlib library

nginx
path prefix: " /usr/local/nginx "
nginx binary file:
" /usr/sbin/nginx "
nginx configuration prefix:
" /etc/nginx "
nginx configuration file:
" /etc/nginx/nginx.conf "
nginx pid file:
" /var/run/nginx/nginx.pid "
nginx error log file:
" /var/log/nginx/error.log "
nginx http access log file:
" /var/log/nginx/access.log "
nginx http client request body temporary
files : " /var/tmp/nginx/client/ "
nginx http proxy temporary
files : " /var/tmp/nginx/proxy/ "
nginx http fastcgi temporary
files : " /var/tmp/nginx/fcgi/ "
nginx http uwsgi temporary
files : " uwsgi_temp "
nginx http scgi temporary
files : " scgi_temp "

Debian/Ubuntu  Linux下安装pcre-devel:

sudo apt-get update 

sudo apt-get install libpcre3 libpcre3-dev

还需要安装:
sudo apt-get install openssl libssl-dev

Nginx管理参数(可以通过help得到):

-?,-h : this help

-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /usr/local/nginx/)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file

Nginx允许列出整个目录(默认为不列出):
打开nginx.conf文件,在location server 或 http段中加入
autoindex on;

其他参数:

autoindex_exact_size off;

默认为on,显示出文件的确切大小,单位是bytes。
改为off后,显示出文件的大概大小,单位是kB或者MB或者GB

autoindex_localtime on;
默认为off,显示的文件时间为GMT时间。
改为on后,显示的文件时间为文件的服务器时间

转载于:https://www.cnblogs.com/moinmoin/archive/2011/05/17/nginx-setup-manager.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值