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后,显示的文件时间为文件的服务器时间

posted @ 2011-05-17 23:48  TinyZ  阅读(1317)  评论(0)    收藏  举报
编辑推荐:
· 糊涂啊!这个需求居然没想到用时间轮来解决。
· 浅谈为什么我讨厌分布式事务
· 在 .NET 中使用内存映射文件构建高性能的进程间通信队列
· 一个 java 空指针异常的解决过程
· 揭开 SQL Server 和 PostgreSQL 填充因子的神秘面纱
阅读排行:
· 15天流量破10万,免费拼图工具的毕业典礼是被抄袭
· 从硬盘爆满到 GitHub 封号,一位前端开发者的开源历险记
· .NET 使用 DocNET 库快速高效的操作 PDF 文档
· 微软又一自动化开源王炸,Selenium 慌了!
· 分享一个 ProHub 风格 logo 生成器
点击右上角即可分享
微信分享提示