蜗牛789
主机测评与优惠

CentOS6.4部署安装XAMPP1.8.3网站环境建立站点运行

XAMPP环境包我们可能有些朋友在本地电脑中的PHP调试环境都是用的这款一键包,XAMPP安装包是一款比较流行的且可以运行于多个平台的网站环境。支持Linux、MAC和WINDOWS系统中,在这篇文章中,蜗牛需要分享的是在Linux Centos环境中安装XAMPP,然后可以在其运营平台中安装站点建站。

第一、准备工作

如果我们是VPS新手用户,个人还是建议选择大众使用较多的WEB面板、一键包等环境,毕竟可以参考的教程文档比较多。鉴于蜗牛纯属折腾,于是就在基于centos6 32/64位环境中部署XAMPP1.8.3环境。

yum update
yum remove httpd*

升级系统,然后清理已有的环境以免出现安装冲突。

第二、下载和安装XAMPP

#CentOS 32位

cd /tmp
wget http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/1.8.3/xampp-linux-1.8.3-4-installer.run

#CentOS 64位

cd /tmp
wget http://downloads.sourceforge.net/project/xampp/XAMPP%20Linux/1.8.3/xampp-linux-x64-1.8.3-4-installer.run

对应我们当前的系统环境,然后下载XAMPP环境包到TMP文件夹中。

chmod 755 xampp-linux*
./xampp-linux*

授权文件权限,安装XAMPP环境。

然后会看到如上图的安装过程,我们根据步骤输入y继续,直到安装完毕。

/opt/lampp/lampp start

然后重启XAMPP

然后我们可以看到已经启动完毕。这个时候我们去打开IP地址检查是否安装完毕,我们会看到Access forbidden!错误提示,我们需要解决这个问题。

找到/opt/lampp/etc/extra/httpd-xampp.conf 编辑这个文件,找到

<LocationMatch \”^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))\”>
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var

然后把这几行都屏蔽掉(前面加上#)。

# <LocationMatch \”^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))\”>
# Require local
# ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var

然后我们再重启XAMPP

/opt/lampp/lampp restart

我们打开IP之后可以看到XAMPP界面,可以选择简体中文。

这样我们可以看到XAMPP运行OK。

第三、设置XAMPP

打开/opt/lampp/etc/httpd.conf文件,然后编辑

# Include etc/extra/httpd-vhosts.conf

把前面的#去掉,保存,重启XAMPP 。

/opt/lampp/lampp restart

编辑/opt/lampp/etc/extra/httpd-vhosts.conf设置站点,先创建mkdir -p /var/www/html目录,我们需要在HTML目录中建站。

然后在httpd-vhosts.conf文件中配置站点信息。

 ServerAdmin [email protected]
DocumentRoot \”/var/www/html\”
ServerName laozuo.org
ServerAlias www.laozuo.org
ErrorLog \”logs/laozuo.org-error_log\”
CustomLog \”logs/laozuo.org-access_log\” common

执行/opt/lampp/lampp restart重启,然后我们需要设置密码,比如MYSQL密码等。

/opt/lampp/lampp security

XAMPP:  Quick security check…
XAMPP:  Your XAMPP pages are NOT secured by a password.
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Password:
XAMPP: Password (again):
XAMPP:  Password protection active. Please use \’xampp\’ as user name!
XAMPP:  MySQL is accessable via network.
XAMPP: Normaly that\’s not recommended. Do you want me to turn it off? [yes] yes
XAMPP:  Turned off.
XAMPP: Stopping MySQL…ok.
XAMPP: Starting MySQL…ok.
XAMPP:  The MySQL/phpMyAdmin user pma has no password set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Password:
XAMPP: Password (again):
XAMPP:  Setting new MySQL pma password.
XAMPP:  Setting phpMyAdmin\’s pma password to the new one.
XAMPP:  MySQL has no root passwort set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP:  Write the password somewhere down to make sure you won\’t forget it!!!
XAMPP: Password:
XAMPP: Password (again):
XAMPP:  Setting new MySQL root password.
XAMPP:  Change phpMyAdmin\’s authentication method.
XAMPP:  The FTP password for user \’daemon\’ is still set to \’xampp\’.
XAMPP: Do you want to change the password? [yes] yes
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Reload ProFTPD…ok.
XAMPP:  Done.

执行命令之后,我们会操作上面的示范命令。用来设置MYSQL、PHPMYADMIN密码的,然后我们完毕之后,登录HTTP://IP/xampp,执行路径我们可以设置用户名和密码,xampp是用户名,密码是我们设置的。

第四、激活启动eAccelerator

因为有些程序是需要用到eAccelerator的,我们需要启动,默认是关闭的,我们需要到/opt/lampp/etc/php.ini文件中启动,找到下面的代码:

;extension=\”eaccelerator.so\”
;eaccelerator.shm_size=\”16\”
;eaccelerator.cache_dir=\”/opt/lampp/temp/eaccelerator\”
;eaccelerator.enable=\”1\”
;eaccelerator.optimizer=\”1\”
;eaccelerator.check_mtime=\”1\”
;eaccelerator.debug=\”0\”
;eaccelerator.filter=\”\”
;eaccelerator.shm_max=\”0\”
;eaccelerator.shm_ttl=\”0\”
;eaccelerator.shm_prune_period=\”0\”
;eaccelerator.shm_only=\”0\”
;eaccelerator.compress=\”1\”
;eaccelerator.compress_level=\”9\”

然后把前面的;注释去掉保存。

最后,再启动/opt/lampp/lampp restart。我们就可以去目录中添加文件演示站点。

总结,这篇文章蜗牛折腾在CENTOS中安装XAMPP环境,如果你也想折腾也可以玩玩。对于XAMPP环境在我们本地PHP调试的时候用的较多,或者MAC环境中也有不少用到的。

About 蜗牛

【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。





评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址