nginx

``` yum -y install openssl openssl-devel wget nginx.org/download/nginx-1.14.0.tar.gz tar -zxf nginx-1.14.0.tar.gz cd nginx-1.14.0 #3.复制Nginx默认提供的vim语法插件 mkdir ~/.vim cp -r contrib/vim/* ~/.vim/ ./configure --prefix=/home/Learn_Nginx/nginx/ --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-http_stub_status_module --with-threads --with-file-aio make && make install #检查Prefix指定的安装目录 #[root@chaogelinux nginx-1.14.0]# ls /home/Learn_Nginx/ #nginx nginx-1.14.0 nginx-1.14.0.tar.gz ln -s /home/Learn_Nginx/nginx/sbin/nginx /usr/bin/ #创建nginx的环境变量文件,修改如下,创建/etc/profile.d/nginx.sh脚本文件便于以后维护 [root@chaogelinux ~]# cat /etc/profile.d/nginx.sh export PATH=/home/Learn_Nginx/nginx/sbin:$PATH #去配置文件目录 cd /home/Learn_Nginx/nginx/conf cat > `pwd`/file-18080.conf <<EOF server { access_log /data02/nginx_logs/version_file_access.log;#配置访问日志存放地址 listen 18080; #文件服务器端口根据实际配置 charset utf-8; autoindex on; autoindex_exact_size off; autoindex_localtime on; location / { root /mnt/serverfile;#文件服务器中存放文件的目录, 请根据实际配置 } } EOF 将自定义配置文件 include到nginx.conf中 在nginx.conf配置文件中增加引用 include /home/Learn_Nginx/nginx/conf/file-*.conf; mkdir -p /mnt/serverfile /data02/nginx_logs/ nginx -s reload ```