Nginx学习笔记——安装

Nginx安装

linux安装

下载 tar.gz 包,以及依赖 openssl、zlib、pcre

openssl、zlib、pcre 安装

1cd 对应目录  2./configure 3make 4make install

nginx 安装

1cd 对应目录 2./configure --with-pcre=pcre路径 --with-zlib=zlib路径 --with-openssl=openssl路径 3make 4make 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 默认配置

默认配置如下

1user nginx; 2worker_processes 1; #启用的进程数,根据cpu数量配置 3 4error_log /var/log/nginx/error.log warn; #错误日志输出文件 5pid /var/run/nginx.pid; 6 7 8events { 9 worker_connections 1024; #单个后台worker process进程的最大并发链接数 10} 11 12 13http { 14 include /etc/nginx/mime.types; #设定mime类型,类型由mime.type文件定义 15 default_type application/octet-stream; 16 17 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 18 '$status $body_bytes_sent "$http_referer" ' 19 '"$http_user_agent" "$http_x_forwarded_for"'; #设定日志格式 20 21 access_log /var/log/nginx/access.log main; #日志输出文件 22 23 sendfile on; 24 #tcp_nopush on; 25 26 keepalive_timeout 65; #连接超时时间 27 28 #gzip on; #开启gzip压缩 29 30 include /etc/nginx/conf.d/*.conf; 31} 32 33 34server { 35 listen 80; #监听端口 36 server_name localhost; #使用localhost访问时 37 38 #charset koi8-r; 39 #access_log /var/log/nginx/log/host.access.log main; #设定本虚拟主机的访问日志 40 41 location / { 42 root /usr/share/nginx/html; #服务器网站根目录 43 index index.html index.htm; #首页文件的名称 44 } 45 46 #error_page 404 /404.html; 47 48 # redirect server error pages to the static page /50x.html 49 # 50 error_page 500 502 503 504 /50x.html; # 定义错误提示页面 51 location = /50x.html { 52 root /usr/share/nginx/html; 53 } 54 55 # proxy the PHP scripts to Apache listening on 127.0.0.1:80 56 # php脚本请求转发到 http://127.0.0.1 57 #location ~ \.php$ { 58 # proxy_pass http://127.0.0.1; 59 #} 60 61 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 62 # PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI默认配置. 63 #location ~ \.php$ { 64 # root html; 65 # fastcgi_pass 127.0.0.1:9000; 66 # fastcgi_index index.php; 67 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 68 # include fastcgi_params; 69 #} 70 71 # deny access to .htaccess files, if Apache's document root 72 # concurs with nginx's one 73 # 禁止访问 .htxxx 文件 74 #location ~ /\.ht { 75 # deny all; 76 #} 77}
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )