nginx 文件服务器美化

网络上很多使用 nginx 来作为文件服务器的,前段时间公司也有这个需求,就研究了一下使用 nginx 来做文件服务器,参见前面两 …

more ...

nginx开启Gzip压缩

[gallery ids="1256"]

为什么要开启Gzip压缩
启用Gzip压缩功能, 可以使网站的css、js 、xml、html 等静态资源在传输时进行压缩,经过Gzip压缩后资源可以变为原来的30%甚至更小,尽管这样会消耗 …
more ...

nginx http 80 端口重定向到 https 443 端口

image1

修改 nginx 配置文件

[root@hostname /]# vim /etc/nginx/conf.d/default.conf>

在新增一个server,用于跳转

server {
    listen       80 default;
    server_name  www.on0913.com on0926.com;
    rewrite ^(.*)$ https://${server_name}$1 permanent;
}

原有的server listen 端口修改 …

more ...

/etc/php-fpm.d/www.conf 配置参数详解

emergency_restart_threshold = 10
在指定的一段时间内,如果失效的php-fpm子进程数超过这个值,php-fpm主进程优雅重启
emergency_restart_interval = 1m
设定emergency_restart_threshold 设置采用的时间跨度,s(econds), m(inutes), h(ours), or d(ays)
user = www
拥有这个php-fpm进程池中子进程的系统用户。要把 …
more ...

ngxtop 报错

[root@**** ~]# ngxtop
Traceback (most recent call last):
  File "/usr/local/bin/ngxtop", line 7, in
    from ngxtop.ngxtop import main
  File "/usr/local/lib/python3.6/site-packages/ngxtop/ngxtop.py", line 77, in
    from config_parser import detect_log_config, detect_config_path, extract_variables, build_pattern
ModuleNotFoundError: No module named 'config_parser'
解决方法:
卸 …
more ...

Nginx 出现413 Request Entity Too Large得解决方法

今天处理文件上传功能的时候,总是提示接口错误,很是郁闷。换小文件发现没有问题,所以问题肯定出现在文件大小上。切 …

more ...

nginx 出现an upstream response is buffered to a temporary file

今天检查机器运行情况的时候在日志里看到这么一条:

2017/02/14 11:25:05 [warn] 32254#32254: *34 an upstream response is buffered to a temporary file /var/cache/nginx/fastcgi_temp/3/00/0000000003 while …
more ...

Nginx 配置虚拟主机

  1. 当前nginx的版本
[root@localhost ~]# nginx -v
nginx version: nginx/1.10.3
2. 查看nginx 目录结构
[root@localhost ~]# cd /etc/nginx/
[root@localhost nginx]# tree ../nginx
../nginx
├── conf.d
│   ├── default.conf
│   └── default.conf.rpmsave
├── fastcgi_params
├── koi-utf
├── koi-win
├── mime.types
├── modules -> ../../usr/lib64/nginx/modules
├── nginx …
more ...

nginx+ php 配置 access denied

之前配置nginx+php的时候,每次,访问html页面是正常的,但是一旦访问php的页面就出现acces denied.

后来发现是nginx配置问题/etc/nginx/conf.d/default.conf

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        root   /data …
more ...

Centos 安装 Nginx

根据nginx官网的说明:

可以进行如下操作:

编辑并且创建/etc/yum.repos.d/nginx.repo,输入以下内容

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

参考地址:https …

more ...