0.在根目录设置两个文件夹app2并新建index.html
mkdir /app2
echo "hello app2" > index.html
1.httpd.conf配置如下内容:
Alias /app22 /app2
<Directory "/app2">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Require all granted
</Directory>
2.把selinux防火墙设置为允许访问(permissive)
setenforce 0
3.重启httpd
service httpd restart
4.curl localhost/app22/ 或用浏览器输入"相应的ip"/app2访问
5.注意点
如果没用setenforce 0
或
没有配置
<Directory "/app2">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
Require all granted
</Directory>
则访问时会报错:You don't have permission to access