Nginx学习笔记——安装
2016-08-18 00:00
267 查看
摘要: 安装、默认配置解析
openssl、zlib、pcre 安装
nginx 安装
ps:./configure 用法 参考
http://www.linuxidc.com/Linux/2011-02/32211.htm
http://www.cnblogs.com/tdalcn/archive/2011/11/11/2245402.html
./configure -prefix=/usr 意思是将该软件安装在 /usr 下面,执行文件就会安装在 /usr/bin,资源文件就会安装在 /usr/share(而不是默认的/usr/local/share),具体可以通过 --help 查看。
windows安装
官网下载windows版本 安装之后,双击启动(窗口会一闪而过,会有两个nginx进程,应该是主和从)
Nginx安装
linux安装
下载 tar.gz 包,以及依赖 openssl、zlib、pcreopenssl、zlib、pcre 安装
cd 对应目录 ./configure make make install
nginx 安装
cd 对应目录 ./configure --with-pcre=pcre路径 --with-zlib=zlib路径 --with-openssl=openssl路径 make make install
ps:./configure 用法 参考
http://www.linuxidc.com/Linux/2011-02/32211.htm
http://www.cnblogs.com/tdalcn/archive/2011/11/11/2245402.html
./configure -prefix=/usr 意思是将该软件安装在 /usr 下面,执行文件就会安装在 /usr/bin,资源文件就会安装在 /usr/share(而不是默认的/usr/local/share),具体可以通过 --help 查看。
windows安装
官网下载windows版本 安装之后,双击启动(窗口会一闪而过,会有两个nginx进程,应该是主和从)
Nginx 默认配置
默认配置如下user nginx; worker_processes 1; #启用的进程数,根据cpu数量配置 error_log /var/log/nginx/error.log warn; #错误日志输出文件 pid /var/run/nginx.pid; events { worker_connections 1024; #单个后台worker process进程的最大并发链接数 } http { include /etc/nginx/mime.types; #设定mime类型,类型由mime.type文件定义 default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; #设定日志格式 access_log /var/log/nginx/access.log main; #日志输出文件 sendfile on; #tcp_nopush on; keepalive_timeout 65; #连接超时时间 #gzip on; #开启gzip压缩 include /etc/nginx/conf.d/*.conf; }
server { listen 80; #监听端口 server_name localhost; #使用localhost访问时 #charset koi8-r; #access_log /var/log/nginx/log/host.access.log main; #设定本虚拟主机的访问日志 location / { root /usr/share/nginx/html; #服务器网站根目录 index index.html index.htm; #首页文件的名称 } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; # 定义错误提示页面 location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # php脚本请求转发到 http://127.0.0.1 #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI默认配置. #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # 禁止访问 .htxxx 文件 #location ~ /\.ht { # deny all; #} }
相关文章推荐
- Nginx学习笔记(零):ubuntu下安装pcre、zlib、openssl
- Nginx学习笔记(1)--安装步骤
- Nginx学习笔记(一):nginx的安装和配置
- Nginx学习笔记(一)---Linux下安装Nginx
- Linux下Oracle安装宝典 oracle8.1.6
- Red Hat Linux 7.0安装使用手记(六则)
- 如何在你的Linux机器上安装运行Oracle jdbc:thin with java (OAS) DBA
- [安装]ISO文件解析
- linux 无盘安装 没有光驱 无光驱 rawrite ftp安装
- 设定自安装apache服务器自启动功能
- linux 下 squid 安装日志
- 系统管理员必读:为 Linux 安装套件强化系统安全!
- 如何用Linux安装TCP/IP路由器 route subnet arp
- Linux下声卡驱动软件ALSA的安装与配置
- Kylix安装手记
- 怎样在Apache上安装MOD_SSL
- Apache、SSL、MySQL和PHP平滑无缝地安装
- Linux -安装PHP7
- 如何在你的Linux机器上安装运行Oracle
- 如何调试 VB 6 的安装源程序 Setup1.VBP?