这些是我的虚拟机设置:
HOST: windows 7 ultimate 32bit
GUEST: CentOs 6.3 i386
Virtualization soft: Oracle virtualBox 4.1.22
Networking: NAT -> (PORT FORWARD: HOST:8080 => GUEST:80)
Shared Folder: centos
所有项目文件都进入共享文件夹,每个项目文件都会在
/etc/httpd/conf.d/
中创建一个虚拟主机配置文件。喜欢 /etc/httpd/conf.d/$domain
如果我在 centos 中同时禁用 windows 防火墙和 iptables 之前,我无法在浏览器中看到任何内容,例如:
http://www.$domain:8080/
我所看到的是:Forbidden
You don't have permission to access / on this server.
Apache/2.2.15 (CentOS) Server at www.$domain.com Port 8080
示例虚拟主机 conf 文件:
<VirtualHost *:80>
#General
DocumentRoot /media/sf_centos/path/to/public_html
ServerAdmin webmaster@$domain
ServerName www.$domain
ServerAlias $domain *.$domain
#Logging
ErrorLog /var/log/httpd/$domain-error.log
CustomLog /var/log/httpd/$domain-access.log combined
#mod rewrite
RewriteEngine On
RewriteLog /var/log/httpd/$domain-rewrite.log
RewriteLogLevel 0
</VirtualHost>
centos
共享文件夹可供 guest 访问 /media/sf_centos
这些是 sf_centos
的文件权限:drwxrwx--- root vboxsf
vboxsf
组包括:apache
和 root
所以这些是我的问题:
1-如何解决禁忌问题?
2-如何设置主机和访客防火墙?
3-如何改进这个开发环境以尽可能多地模拟生产环境,特别是安全改进?
最佳答案
对于 #1/2:这是由于 VirtualBox 使用的自动挂载方法导致的权限问题。您必须手动安装它,而不是自动安装。
suomynona 的帖子(第 3 次回复)有一些关于解决此问题的分步说明:
https://forums.virtualbox.org/viewtopic.php?f=3&t=38891#p179152
至于#3,标准做法是拥有一个尽可能模仿生产的登台服务器(相同的操作系统,相同的更新,版本等)。这将允许您在部署到生产之前从本地开发环境进行部署以进行集成测试。有时我们甚至会设置我们的开发虚拟机使用与生产相同的操作系统来处理版本/兼容性问题可能会导致头痛的更复杂的项目。
关于windows-7 - 403 Forbidden on Apache (CentOS) Server as GUEST 在 Windows 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12443215/