Nginx安装
来源:互联网 发布:整理文件的软件 编辑:程序博客网 时间:2024/05/18 01:10
Nginx安装
首先,大家如果看到有什么不懂的地方,欢迎吐槽!!!
我会在当天或者第二天及时回复,并且改进~~
Nginx安装步骤:
一、添加用户
groupadd nginxuseradd -M -s /sbin/nologin -g nginx nginx
二、解包
tar zxf nginx-1.0.14.tar -C /usr/local/srctar zxf pcre-8.30.tar -C /usr/local/srctar zxf zlib-1.2.7.tar -C /usr/local/src
三、安装依赖包及nginx包
cd /usr/local/src/pcre./configure --prefix=/usr/local/pcremake && make installcd /usr/local/src/zlib./configure --prefix=/usr/local/zlibmake && make installcd /usr/local/src/nginx./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-pcre=/usr/local/src/pcre-8.30 --with-zlib=/usr/local/src/zlib-1.2.7
这里的pcre路径是源码路径,而不是安装后的路径
./configure --help | grep pcre 查看 ./configure --help | grep zlib 查看
四、编译安装
make && make install
五、Nginx.conf配置档介绍
cat nginx.conf
user nginx; #进程运行用户worker_processes 1; #工作进程数量worker_rlimit_nofile 10000; #设置worker进程的最大文件打开数限制。如果没设置的话,这个值为OS的系统限制 ulimit -aerror_log logs/error.log; #错误日志目录pid logs/nginx.pid; #pid文件路径 events { #I/O事件配置 use epoll; #epoll模型以提高nginx性能 worker_connections 2048; #每个工作进程处理2048个连接} http { #标记包括访问日志、HTTP端口、网页目录、默认字符集、连接保持 include mime.types; default_type application/octet-stream; access_log logs/access.log; #访问日志路径 sendfile on; #支持文件发送(下载) keepalive_timeout 65; #连接保持超时 server { #Web服务的监听配置 listen 192.168.1.200:80; #监听IP和端口 server_name www.wl.com; #服务器域名 charset utf-8; #默认字符集 location / { #根目录配置 root html; #网页根目录 index wl.html; #默认首页 } location ~ /status { #访问位置为/status stub_status on; #打开状态统计功能 access_log off; #关闭此位置的日志记录 } error_page 500 502 503 504 /50x.html; #错误码及对应的页面 location = /50x.html { #错误页面配置 root html; #错误页面根目录} error_page 403 /403.html; #错误码及对应的页面 location = /403.html { #错误页面配置 root html; #错误页面根目录} } server { #Web服务的监听配置 listen 192.168.1.200:80; #监听IP和端口 server_name www.fx.com; #服务器域名 charset utf-8; #默认字符集 location / { #根目录配置 root html; #网页根目录 index fx.html; #默认首页 } location ~ /status { #访问位置为/status stub_status on; #打开状态统计功能 access_log off; #关闭此位置的日志记录 } error_page 500 502 503 504 /50x.html; #错误码及对应的页面 location = /50x.html { #错误页面配置 root html; #错误页面根目录} error_page 403 /403.html; #错误码及对应的页面 location = /403.html { #错误页面配置 root html; #错误页面根目录}}}
0 0
- nginx笔记:nginx安装
- Nginx-----源码安装nginx
- 【nginx】nginx的安装
- 安装Nginx
- nginx安装
- 安装 nginx
- 安装nginx
- 安装 Nginx
- nginx安装
- Nginx安装
- 安装Nginx
- 安装nginx
- nginx安装
- 安装nginx
- Nginx安装
- nginx安装
- nginx安装
- nginx 安装
- UpdatePanel控件的使用(实现局部刷新,ajax)
- soapui中文操作手册(六)----创建REST Testing
- strlen与strcpy函数实现的浅谈及辨析sizeof运算符与strlen函数的区别
- MSSql Server基础学习系列———基础讲解
- 硬件创业必算的一本账
- Nginx安装
- 第三十二天FragmentAdapter、数据存储、SQLite
- Java中的for循环
- 通过当年第几天,获取日期的方法
- YII执行流程图
- soapui中文操作手册(七)----Web Service Sample Project
- Hssfworkbook 设置单元格格式 setdataformat
- vector中的resize()和reserve()
- 阅读《Android 从入门到精通》(2)——熟悉开发环境