nginx启用Userdir【nginx】

来源:互联网 发布:海文网络计划软件使用 编辑:程序博客网 时间:2024/06/01 15:21

作者:【吴业亮】云计算开发工程师
博客:http://blog.csdn.net/wylfengyujiancheng

1、修改配置文件 /etc/nginx/nginx.conf

# 在"server" 章节加入         location ~ ^/~(.+?)(/.*)?$ {            alias /home/$1/public_html$2;            index  index.html index.htm;            autoindex on;        }

2、重启服务

# systemctl restart nginx 

3、配置

# useradd wyl# su - wyl$ chmod 711 /home/wyl $ mkdir ~/public_html $ chmod 755 ~/public_html 

4、创建文件并写入 ~/public_html/index.html

<html><body><div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">Nginx UserDir Test Page</div></body></html>

5、测试
这里写图片描述

0 0
原创粉丝点击