1、xampp 虚拟主机执行perl 的方法
在你的虚拟机里面增加配置
ScriptAlias /cgi-bin/ "D:/htdocs/cgi-bin/"
然后设置对应的目录D:/htdocs/cgi-bin/的权限
<Directory "D:/htdocs/cgi-bin">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
重新启动apache就OK了
2、如何配置XAMPP的虚拟主机
1.下载并安装好xampp,这个过程就不掩饰了哇。
如果已经打开了apache服务器,先将其关掉。接下来进入配置虚拟主机:
我这里先项目放在了D盘,文件夹名称project,新建一个index.php文件,双击打开文件后写入测试代码:
<?php
phpinfo();
?>
代码什么意思相信大家都懂的!
3
2.找到你的xampp安装目录,依次找到下面的目录:apache目录--conf目录--extra目录--httpd-vhosts.conf文件,使用编辑器打开,notepad等等...
PS:目录的话,大家根据图走就行;
4
3.打开文件后,在最下边写入如下代码:
<VirtualHost *:80>
ServerName project.com
DocumentRoot "D:/Developing/project"
<Directory "D:/Developing/project">
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm index.php
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
</VirtualHost>
保存。
其中的网站名称和项目路径需要大家根据自己的实际情况去更改,切不可照搬!
5
4.打开C盘,依次找到下面的目录:windows目录--system32目录--drivers目录--etc目录--找到hosts文件,使用编辑器打开;
6
5.最文件最下边加入如下代码:
127.0.0.1 project.com 保存。
启动apache服务器,输入你的网站名称,如果结果和如图一样,则说明xampp配置虚拟主机成功。
3、虚拟机安装xampp 主机无法访问
你给的信息太少,你有xampp提供的控制工具来打开看看,具体的错误提示有哪些,还有,apache的端口是不是被其它程序占用了,比如IIS!
4、Mac os XAMPP配置了虚拟主机之后IP地址访问403
httpd.conf
第一步:注销,如下样式:
#DocumentRoot "C:/myenv/apache/htdocs"
第二步:启动虚拟主机的配置,如下样式:
Include conf/extra/httpd-vhosts.conf
第三步:配置httpd-vhosts.conf,增加如下样式:
<VirtualHost *:80>
DocumentRoot "D:/myblog2"
ServerName seophp.example.com
DirectoryIndex test.html index.html index.htm index.php
<Directory />
Options FollowSymLinks
#AllowOverride None 不许可别人修改我们的页面
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
注意标点符号,apache对中英标点号是不检测的,但是运行会出问题。
如果不行就看一下\apache\logs\error.log转上看看。
你这些是否是多余的
《httpd.conf检查了httpd-vhosts.conf是打开的
httpd-vhosts.conf中的配置如下:
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
DocumentRoot "D:/xampp/htdocs"
ServerName localhost
</VirtualHost>
》
5、xampp apache2怎么配置虚拟主机
用护卫神.apache大师,自带主机管理系统。
6、如何配置 Apache 的虚拟主机
1、基于ip地址的虚拟主机
复制代码代码如下:
Listen 80
<VirtualHost 172.20.30.40>
DocumentRoot /home/httpd/html1
ServerName www.ok1.com
ErrorLog /usr/local/apache/logs/error1_log
CustomLog /usr/local/apache/logs/access1_log combined
</VirtualHost>
<VirtualHost 172.20.30.50>
DocumentRoot /home/httpd/html2
ServerName www.ok2.com
ErrorLog /usr/local/apache/logs/error2_log
CustomLog /usr/local/apache/logs/access2_log combined
</VirtualHost>
2、基于IP 和多端口的虚拟主机配置
复制代码代码如下:
Listen 172.20.30.40:80
Listen 172.20.30.40:8080
Listen 172.20.30.50:80
Listen 172.20.30.50:8080
<VirtualHost 172.20.30.40:80>
DocumentRoot /www/example1-80
ServerName www.example1.com
</VirtualHost>
<VirtualHost 172.20.30.40:8080>
DocumentRoot /www/example1-8080
ServerName www.example1.com
</VirtualHost>
<VirtualHost 172.20.30.50:80>
DocumentRoot /www/example2-80
ServerName www.example1.org
</VirtualHost>
<VirtualHost 172.20.30.50:8080>
DocumentRoot /www/example2-8080
ServerName www.example2.org
</VirtualHost>
3、单个IP 地址的服务器上基于域名的虚拟主机配置
复制代码代码如下:
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example1.com
ServerAlias example1.com. *.example1.com
# Other directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/example2
ServerName www.example2.org
# Other directives here
</VirtualHost>
如果您感觉上面的文章还不够详细可以看下下面的文章:
实验目标:在apache实现基于域名的虚拟主机
实验用的XAMPP版本为1.7.7,内含apache版本为2.2.21
实验前准备:
1. 为了测试不同的域名,在Windows/System32/drivers/etc/下觅得hosts文件,在其中添加实验用的域名若干,如 -
复制代码代码如下:
127.0.0.1 test1.net
127.0.0.1 test2.net
如此,则在浏览器中输入该俩域名时,Windows将其解析为127.0.0.1本地地址。即,在浏览器中访问localhost, test1.net, test2.net均可访问XAMPP的欢迎页。
2. 在apache目录下建立目录,以放置您不同的网站。为保护XAMPP原有的htdocs中的欢迎页内容,实验另外建立了与htdocs平级的htdocs1目录,在其下建立了test1.net, test2.net两个子目录用以放置实验用的网站。如下 -
apache/htdocs1/test1.net - 放置test1.net网站内容
apache/htdocs1/test2.net - 放置test2.net网站内容
在这两个目录中各新建hello world一网页 index.html,内容 -
复制代码代码如下:
<HTML>
<HEAD></HEAD>
<BODY>
<H1>hello~, 这是[对应的网站名,用以区别].net</H1></BODY>
</HTML>
实验步骤:
1. 找到apache/conf/httpd.conf, 将其中的
ServerAdmin
ServerName
DocumentRoot
注释掉。
2. 在httpd.conf中,找到行
Include "conf/extra/httpd-vhosts.conf"
如被注释则解注。该文件记载了虚拟主机的参数。[以前虚拟主机参数是直接填写在httpd.conf中的,为了更好地组织文件,将其分离出去,类似于某些编程语言一样。因此httpd.conf中include它,即相当于把它的内容填在了httpd.conf中。]
3. 这个httpd-vhosts.conf文件格式基本如下 -
复制代码代码如下:
#blah-blah
NameVirtualHost *:80
#blah-blah
#blah-blah
<VirtualHost *:80>
ServerAdmin XXXXXXXX
DocumentRoot "XXXXXXXX"
ServerName XXXXXXX
ServerAlias XXXXXX
ErrorLog "logs/XXXXXX-error.log"
CustomLog "logs/XXXXXXX-error.log" combined
</VirtualHost>
需要修改的,就是<VirtualHost>中的参数了。这个可以参见apache官方文档。根据实验域名,可以增加两个<VirtualHost>:
复制代码代码如下:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/xampp/htdocs1/test1.net"
ServerName test1.net
ServerAlias www.test1.net
ErrorLog "logs/test1-error.log"
CustomLog "logs/test1-access.log" combined
<Directory "C:/xampp/htdocs1/test1.net">
order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/xampp/htdocs1/test2.net"
ServerName test2.net
ServerAlias www.test2.net
ErrorLog "logs/test1-error.log"
CustomLog "logs/test1-access.log" combined
<Directory "C:/xampp/htdocs1/test2.net">
order allow,deny
allow from all
</Directory>
</VirtualHost>
注意,如果不在各VirtualHost中定义Directory的可访问性,你将遇到的是Access Forbidden!就连原来的localhost也是。
4. 由于之前注释掉了httpd.conf中的ServerName, DocumentRoot等,为了仍然能以localhost访问原XAMPP欢迎页,就在增加一个VirtualHost,如下 -
复制代码代码如下:
<VirtualHost *:80>
ServerAdmin adm@localhost
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" combined
<Directory "C:/xampp/htdocs">
order allow,deny
allow from all
</Directory>
</VirtualHost>
为了避免出错,把它放置在第一个Virtualhost位置。
至此,apache基于域名的虚拟主机配置完成。可以通过http://localhost访问XAMPP欢迎页,通过http://test1.net和http://test2.net访问各自的主页。
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "E:/sky/apache2/htdocs"
ServerName localhost
ServerAlias www.sky.com
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" combined
<Directory "E:/sky/apache2/htdocs">
order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "E:/sky/apache2/htdocs/project1"
ServerName project1.com
ServerAlias www.project1.com
ErrorLog "logs/project1-error.log"
CustomLog "logs/project1-access.log" combined
<Directory "E:/sky/apache2/htdocs/project1">
order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "E:/sky/apache2/htdocs/zendTest/public"
ServerName zendTest.com
ServerAlias www.zendTest.com
DirectoryIndex index.php
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "E:/sky/apache2/htdocs/testRewrite"
ServerName testRewrite.com
ServerAlias www.testRewrite.com
# DirectoryIndex index.php
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "E:/sky/apache2/htdocs/test"
ServerName test.com
ServerAlias www.test.com
ErrorLog "logs/zendTest-error.log"
CustomLog "logs/zendTest-access.log" combined
<Directory "E:/sky/apache2/htdocs/test">
order allow,deny
allow from all
</Directory>
</VirtualHost>
7、如何在VMware Workstation11的Windows Server 2008 R2中安装XAMPP
先到官网上下载windows server 2012体验版ISO。
在VMware Workstation上新建一个虚拟机,硬件配置不低于要求的512内存和32G硬盘空间。中间提示需要输入产品密钥等信息可以先不填,直接点击“下一步”
这里的硬件配置是1G内存,60G硬盘。
点击完成后打开虚拟机电源,系统通过光盘启动安装程序
安装程序启动后第一步是选择要安装语言。
这里按默认选项几可,点击“下一步”提示现在安装,左下角有个比较有意思的功能“修复计算机”
点击修复计算机后有“疑难解答”和“关闭电脑”两选项,疑难解答提示恢复或初始化电脑或者使用高级工具
于是点击进去看了一下才知道,说的高级工具是“系统映像恢复”和“命令提示符”就是高级工具呀,系统映像恢复估计类似修复光盘的功能,而命令后提示就是咱们装98时用的命令环境。真是高级呀。。
到这个界面来以后,没有返回到安装界面的地方,只能用命令提示符,进到光盘,执行下“setup”命令了,回想起win98了吧
8、你好,ubuntu下xampp配置虚拟主机的问题我情况和你的一样。请问 sudo vi /etc/resolv.conf 内容要怎么写
这个相当于windows系统中的dns服务器,写两个常用的dns服务器就可以了,和虚拟主机配置应该关系不大。比如
nameserver 8.8.8.8
9、linux下Xampp 中ftp的配置问题
简单的办法就是 在linux中分别创建帐号,并且把帐号主目录设置为相关的目录
useradd -g ftp -d /opt/lampp/htdocs/web1 -s /sbin/nologin web1
这样就添加了一个 ftp组的用户web1 ,主目录是 /opt/lampp/htdocs/web1 无登录权限(只允许通过ftp登录),创建用户的时候会生成主目录,不要自己创建 /opt/lampp/htdocs/web1,
然后就是passwd web1 为其设置密码
如果用户比较多,上百个这样子就需要用到虚拟用户了,虚拟用户的设置 就没那么简单了,,到网上找找相应的文章吧。
10、虚拟机上安装的CentOS,然后安装了Xampp,虚拟机上面能够访问,就是本地不能直接访问,本地能够ping通
在centos关闭selinux和防火墙试试