今天编译了下nginx,编译nginx需要事先下载并编译完成pcre zlib openssl模块,将路径指向编译好的源文件。
http://www.openssl.org/source
http://www.zlib.net
http://www.pcre.org/
http://nginx.org/download
用普通用户编译,编译完成发现./nginx -t 是failed 原来是nginx.conf默认端口为80,而1024以下的端口为root用户才可以使用,于是改端口为8081。
2、配置文件下载,即允许访问目录
# 在nginx.conf中加入以下语句
location /dir_name/ {
autoindex on;
}
3、nginx启动方法
进入sbin目录
$ ./nginx -t # 测试配置文件有没错误
$ ./nginx # 启动
$ ./nginx -s quit # 平滑重启