在Linux上安装XAMPP并配置虚拟主机备忘

1. 到https://www.apachefriends.org/zh_cn/index.html去下载最新版本,注意x86还是x64

2. 下载存放到任意位置,我这里存到 /home下,接下来修改安装文件权限,为方便直接赋予777  chmod 777 xampp-linux-x64-5.6.32-0-installer.run

3. 运行./xampp-linux-x64-5.6.32-0-installer.run,默认安装即可

4. 这里要注意,我原本想安装到一块外挂的SSD硬盘目录,结果查了很多资料都没有找到方法,只好把/opt目录mount到SSD硬盘了

5. 安装完毕后配置一下/opt/lampp/etc/httpd.conf, 去掉Include etc/extra/httpd-vhosts.conf之前的#,使虚拟配置文件生效

6. 编辑/opt/lampp/etc/extra/httpd-vhosts.conf文件

  
   默认信息如下:
   <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/opt/lampp/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common
   </VirtualHost>
   
   修改域名等配置信息,然后增加目录访问权限,增加权限时只需要到httpd.conf中找到<Directory "/opt/lampp/htdocs"></Directory>
   把这个标签连带内容拷贝过来,同时修改一下目录即可
   
    <VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/opt/webdocs/test"
ServerName aa.test.com
ErrorLog "logs/aa.test.com-error_log"
CustomLog "logs/aa.test.com-access_log" common

<Directory "/opt/webdocs/test">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/trunk/mod/core.html#options
# for more information.
#
#Options Indexes FollowSymLinks
# XAMPP
Options Indexes FollowSymLinks ExecCGI Includes


#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
#AllowOverride None
# since XAMPP 1.4:
AllowOverride All


#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
   </VirtualHost>

猜你喜欢

转载自blog.csdn.net/missmecn/article/details/78918043
今日推荐