如何将 Apache localhost 从 /var/www 移动到我的挂载目录
我是 ubuntu(和 Linux)的新手,有一个简单的问题。
我已安装目录 /media/2A98EDD2ACA90087/WebProject/ 并希望将 http:/localhost/ 从 var/www 移动到 /media/2A98EDD2ACA90087/WebProject/
我已更改 site-enabled/000-default 和 /etc/apache2/sites -available
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /media/2A98EDD2ACA90087/WebProject
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /media/2A98EDD2ACA90087/WebProject>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
并且有这个 apache 消息!
禁止 您无权访问此服务器上的 /
当我创建“test”目录并将 localhost 从 var/www 移动到 var/www/test 时 - 一切正常。我认为文件权限有问题??!我该怎么办?
问题已经解决了。谢谢帕特里克和约翰。确实需要授予对index.html的读取访问权限: chmod 644 /media/2A98EDD2ACA90087/WebProject/index.html
但我无法更改对我的Ntfs安装驱动器的访问权限。我必须重新安装
为什么无法更改 ubuntu 上外部硬盘驱动器的权限所有权组
I am new in ubuntu(and Linux) and have simple-lamer question.
I have mounted directory /media/2A98EDD2ACA90087/WebProject/ and would like to move http:/localhost/ from var/www to /media/2A98EDD2ACA90087/WebProject/
I have change sites-enabled/000-default and /etc/apache2/sites-available
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /media/2A98EDD2ACA90087/WebProject
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /media/2A98EDD2ACA90087/WebProject>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
And have this apache message!
Forbidden
You don't have permission to access / on this server
When i have created "test" dir and move localhost from var/www to var/www/test - everything works. I suppose that problem with file permissions??!What should i do?
The problem has been solved. Thanks Patrick and Joh. Really need to give read access to index.html: chmod 644 /media/2A98EDD2ACA90087/WebProject/index.html
But i can't change access to my Ntfs mounted drive. I have to remount
why cant change permission ownership group of external hard drive on ubuntu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
apache 服务器以某个用户身份运行——可能是“apache”,你可以运行 ps 来查看——并且该用户必须具有访问 webroot 的权限。您可以使其归 apache 所有,或者使其为组可读(并且您可能希望它为组可写),然后将 apache 添加到拥有它的组,或将组更改为 apache 的组。
假设 httpd 以“apache”(组:apache)运行,而您是“jdoe”(组:jdoe)
The apache server runs as a certain user -- probably "apache", you can run
ps
to see -- and that user must have permission to access the webroot. You can make it be owned by apache, or make it group-readable (and you'll probably want it group-writable) and either add apache to the group that owns it, or change the group to apache's group.Assuming httpd runs as "apache" (group: apache) and you are "jdoe" (group: jdoe)