Nginx微服务搭建-下载器

Nginx微服务搭建-下载器

1、pcre软件安装

准备目录:mkdir -p /data/{server, softs}/nginx
切换目录:cd /data/softs
下载:wget https://sourceforge.net/projects/pcre/files/pcre/8.39/pcre-8.39.tar.gz/download
解压:tar -zxf pcre-8.39.tar.gz
配置:sudo ./configure
编译:sudo make
安装:sudo make install

2、配置主题风格-fancyindex

切换目录:cd /data/softs
下载配置:git clone https://github.com/aperezdc/ngx-fancyindex.git ngx-fancyindex
下载主题:git clone https://github.com/lanffy/Nginx-Fancyindex-Theme.git

3、nginx软件安装

切换目录:cd /data/softs
复制配置:cp ngx-fancyindex /data/server/nginx/
下载:wget http://nginx.org/download/nginx-1.10.2.tar.gz
解压:tar -zxf nginx-1.10.2.tar.gz
配置:sudo ./configure --prefix=/data/server/nginx --without-http_gzip_module --with-http_stub_status_module --add-module=/data/server/nginx/ngx-fancyindex
编译:sudo make
安装:sudo make install

4、配置nginx.conf文件

复制主题:cp /data/softs/Nginx-Fancyindex-Theme /data/server/nginx/html/

切换目录:cd /data/server/nginx/conf

编辑配置:sudo vim nginx.conf

worker_processes auto;
error_log logs/error.log;

http {
# 引用主题配置
include /data/server/nginx/html/Nginx-Fancyindex-Theme/fancyindex.conf;

server {
listen 80;
server_name localhost;
charset utf-8;

# 让主题配置生效
location /Nginx-Fancyindex-Theme {
root html;
}

# 配置目录显示
location / {
alias /data/test_dir/; # 指定要显示的目录
autoindex on; # 开启目录自动索引
autoindex_exact_size off; # 默认on,显示文件大小
autoindex_localtime on; # 默认off,显示文件的服务器时间
}

    # 配置监听状态
    location /status {
            stub_status  on;  # 开启监控状态
            access_log  off;  # 不记录日志
    }
}

}

5、nginx服务操作

检查:/data/server/nginx/sbin/nginx -t
开启:/data/server/nginx/sbin/nginx
关闭:/data/server/nginx/sbin/nginx -s stop
重启:/data/server/nginx/sbin/nginx -s reload

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值