这些是我的虚拟机设置:
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
所有项目文件都进入共享文件夹,对于每个项目文件,都会创建一个虚拟主机 conf 文件,/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
虚拟主机会议文件示例:
<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
共享文件夹可供客人使用 /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,标准做法是拥有一个尽可能模仿生产的暂存服务器(相同的操作系统,相同的更新,版本等)。这将允许您在部署到生产环境之前从本地开发环境进行部署以进行集成测试。有时,我们甚至会将开发 VM 设置为使用与生产相同的操作系统,用于更复杂的项目,其中版本/兼容性问题可能会导致头痛。