canvas教程

nginx学习总结三(nginx的基本配置)

字号+ 作者:H5之家 来源:H5之家 2017-01-04 17:03 我要评论( )

nginx学习总结三(nginx的基本配置),装nginx简单但是必须装pcre这个包。# tar zxvf pcre-7.9.tar.gz# cd pcre-7.9/# ./configure# make make install# tar zxvf

正文

装nginx简单但是必须装pcre这个包。
# tar zxvf pcre-7.9.tar.gz

# cd pcre-7.9/

# ./configure

# make && make install

# tar zxvf nginx-0.7.65.tar.gz

# cd nginx-0.7.65/

#./configure
# make && make install
useradd nginx -M -s /sbin/nologin

按照默认安装 vi /usr/local/nginx/conf/nginx.conf
user nginx nginx;
#运行的用户和组 我一般是采用www用户的。
worker_processes 1;
#指定工作的进程数 一般是CPU总核数的2倍或相等(我这里是虚拟机所以就一个)
例如是2个2核的写4就可以了
#error_log logs/error.log; #错误日志的路径
#error_log logs/error.log notice;
#日志的级别{debug |info |notice |warn |errro |crit}
#error_log logs/error.log info;

#pid logs/nginx.pid; #pid 进程的日志

worker_rlimit_nofile 51200; #打开文件的数量
events {
use epoll; #使用的模型前面讲到了
worker_connections 51200; #允许连接数
}
http {
include mime.types;
default_type application/octet-stream;
#charset gb2312;
# 设置使用的字符集 ,多个网站的请勿乱设置。
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#使用日志记录相当于apache的combined日志格式。。。
#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;
#gzip#头部压缩缓存是否开启。
include vhosts/*.conf;
#区配这个目录下的配置文件我习惯一个虚拟主机一个配置文件
}
[root@localhost local]#mkdir /usr/local/nginx/conf/vhosts/
[root@localhost local]# vi /usr/local/nginx/conf/vhosts/hou.conf
server {
listen 80;
#监听端口
server_name test1.xywy.com;
#域名
#charset koi8-r;
#这个虚拟主机用的字符集
#access_log logs/host.access.log main;
#针对每个域名记录日志
location / {
root /www;
# 虚拟主机目录
index index.html index.htm index.php; #访问页
}

#error_page 404 /404.html; #400错误吧

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
保存启动服务,最基本的nginx的搭建就出来了 呵呵高兴吧。




 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • canvas stroke() beginPath() closePath()

    canvas stroke() beginPath() closePath()

    2017-01-04 16:22

  • 提高HTML5 canvas性能的几种方法!

    提高HTML5 canvas性能的几种方法!

    2017-01-04 13:00

  • 教你用html5 canvas写一个时钟详细解析教程源码

    教你用html5 canvas写一个时钟详细解析教程源码

    2017-01-02 16:00

  • HTML5 实现小车动画效果(Canvas/CSS3/JQuery)

    HTML5 实现小车动画效果(Canvas/CSS3/JQuery)

    2017-01-02 14:01

网友点评
=