Nginx file system in web on CentOS7+

1.Edit repo and install nginx1.9+ by yum

yum -y install nginx



2.vi /etc/nginx/nginx.conf

user  root;
worker_processes  1;


error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;




events {
    worker_connections  1024;
}




http {
server {
client_max_body_size 4G;
listen 80;
server_name localhost;
root /data/www;           #file path
location / {
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;
}
}
}


3.start or stop nginx service
nginx -s stop
nginx -c /etc/nginx/nginx.conf

You can input nginx server's ip on broswer to look your nginx file system.


4.You can also deploy nginx by docker

 a.First step you should download docker image: 

 docker pull nginx:1.9

 b.And then,you should start a docker container by image nginx:1.9

docker run -d -p 12322:80 -v /data/www:/data/www/ --name nginxfile nginx:1.9 


 c.edit nginx configuration file like step 2 and restart container


You can input nginx container's ip:12322 on broswer to look your nginx file system.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值