nginx安装与配置
从今开始,学nginx
#安装pcre
[root@svr3 ~]# tar -xjf pcre-8.02.tar.bz2 -C /usr/src/
[root@svr3 ~]# cd /usr/src/pcre-8.02/
[root@svr3 pcre-8.02]# ./configure && make && make install
#安装nginx
[root@svr3 ~]# useradd -M -s /sbin/nologin nginx
[root@svr3 ~]# tar -xzf nginx-1.0.5.tar.gz -C /usr/src/
[root@svr3 ~]# cd /usr/src/nginx-1.0.5/
[root@svr3 nginx-1.0.5]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx
[root@svr3 nginx-1.0.5]# make && make install
[root@svr3 ~]#vim /usr/local/nginx/conf/nginx.conf
+++++++++++++++相关说明+++++++++++++++++++++++++++++
user nginx; #用户使用nginx
worker_processes 1; #程序启动后,初始化的进程数;内核多的话,可根据内核数量设置。
#error_log logs/error.log;
#error_log logs/error.log notice;
error_log logs/error.log info; #设置错误日志的记录级别
pid logs/nginx.pid; #重启关闭nginx时,需要知道pid文件。
worker_rlimit_nofile 51000;
#
events {
worker_connections 50000; #允许的连接数,我这里设置50000个。
}
http {
include mime.types;
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 logs/access.log main;
sendfile on;
tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 30;
gzip on; #允许gzip压缩。
gzip_buffers 32 4k;
gzip_comp_level 1;
gzip_min_length 1024;
gzip_types text/html text/css application/xml;
server {
listen 80;
相关新闻>>
- 发表评论
-
- 最新评论 更多>>