apahce存储静态文件

公司要把静态文件放到apahce上

默认根目录是/usr/local/apache2.2/htdocs,要改为/home/tnuser/ResourceRoot

所以要修改/usr/local/apache2.2/conf/httpd.conf

设置为

DocumentRoot = /home/tnuser/ResourceRoot

同时将原来的

<Directory "/usr/local/apache2.2/htdocs">

改为

<Directory "/home/tnuser/ResourceRoot">

DocumentRoot意思就是根目录,<Directory>标签是配置文件夹的权限

同时将/usr/local/apache2.2/htdocs/index.html拷贝到/home/tnuser/ResourceRoot下。

最后要修改tnuser和ResourceRoot的权限

默认的话是(不知道哪个家伙设置的)

drw-------  4 tnuser appuser 4096 Oct  3 01:21 tnuser

也就是说外部是没有权限读取的。所以可以

chmod 755 tnuser

chmod 755 ResourceRoot

这样网站外部的用户就可以访问tnuser和ResourceRoot下的静态文件

OK,最后到apache的bin目录下

sudo ./apachectl -k restart

重启apahce

测试:http://hqt-csvrresource-01/index.html

Done!


猜你喜欢

转载自michaelh0226.iteye.com/blog/1184955