centos7+nginx搭建图片服务器

centos7+nginx搭建图片服务器
参考网址

1.安装编译工具及库文件
ubuntu:apt -y install gcc make libssl-dev zlib1g-dev libgd-dev libgeoip-dev libpcre2-dev libpcre3-dev
命令: yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
安装 pcre: yum install -y pcre pcre-devel
查看防火墙状态: systemctl status firewalld
关闭防火墙: systemctl stop firewalld
执行开机禁用防火墙自启命令: systemctl disable firewalld.service
2.切换目录,cd /usr/local/src
下载 nginx-1.17.7.tar.gz
命令: wget http://nginx.org/download/nginx-1.17.7.tar.gz
下载的文件并解压
tar nginx-1.17.7.tar.gz
2.自定义配置
./configure \
--prefix=/kht/nginx \
--conf-path=/kht/nginx/conf/nginx.conf \
--pid-path=/kht/nginx/logs/nginx.pid \
--lock-path=/kht/nginx/logs/nginx.lock \
--error-log-path=/kht/nginx/logs/error.log \
--http-log-path=/kht/nginx/logs/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/kht/nginx/temp/client \
--http-proxy-temp-path=/kht/nginx/temp/proxy \
--http-fastcgi-temp-path=/kht/nginx/temp/fastcgi \
--http-uwsgi-temp-path=/kht/nginx/temp/uwsgi \
--http-scgi-temp-path=/kht/nginx/temp/scgi \
--with-http_stub_status_module \
--add-module=/kht/package/fastdfs-nginx-module-1.20/src
make && make install
6.查看安装目录
whereis nginx
7.启动 Nginx
cd /usr/local/nginx/sbin
./nginx (默认安装 nginx,位置为/usr/local/nginx)
关闭命令./nginx -s stop
8.配置nginx的配置文件检查语法是否正确
vim /etc/profile 增加export PATH=$PATH:/kht/nginx/sbin/
使/etc/profile文件生效source /etc/profile
重启nginx后使用nginx -t名称查看
9.给kht用户授权chmod 777 -R kht/
10.修改nginx.conf的配置文件(查看版本:sbin下./nginx -v)
user  nobody;注释去掉改成root
11.重启nginx服务


posted @ 2021-09-02 14:40  kht  阅读(125)  评论(0编辑  收藏  举报