xampp集成环境搭建

  一.下载安装包

wget http://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.14/xampp-linux-x64-5.6.14-0-installer.run

二.赋予安装包权限
chmod -R 755 xampp-linux-x64-5.6.14-installer.run

三.

重启网络服务

service network restart

启动xampp:

# /opt/lampp/lampp start

重启xampp:

# /opt/lampp/lampp restart
 

停止xampp:

# /opt/lampp/lampp stop

卸载xampp:

# /opt/lampp/lampp stop
# rm -rf /opt/lampp


三、 安装设置

在默认的安装过程中,xampp所有均是没有密码的,为了安全,我们应该为xampp设置密码。该如何操作呢?

# /opt/lampp/lampp security

设置xampp的密码:  XAMPP: Quick security check…  XAMPP: Your XAMPP pages are NOT secured by a password.  XAMPP: Do you want to set a password? [yes] yew  XAMPP: Do you want to set a password? [yes] yes  XAMPP: Password:  XAMPP: Password (again):

用户名默认是:xampp


设置phpMyAdmin的密码:  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.


设置mysql的root账户:  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.

四、 让局域网/外网均可访问

安装完成后,很多时候用locahost来访问时,是没有问题的,但是同一局域网里其它主机用域名访问时,常常不能访问,这里按照下列方法进行排除:

1.修改 /opt/lampp/etc/extra/httpd-vhost.conf 中配置 (需要在"/opt/lampp/htdocs中新增文件夹)

<VirtualHost *:80>
   ServerAdmin www.test.com
   DocumentRoot "/opt/lampp/htdocs/www.test.com"
    ServerName www.test.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

 2. 修改/opt/lampp/etc/httpd.conf

 a.载入vhost配置 #  Include   /opt/lampp/etc/extra/httpd-vhost.conf  去掉#号

 b.更改监听端口  #Listen  12.34.56.78:80  去掉#号,改为自己的(局域网/外网)ip

3. xampp的配置文件:/opt/lampp/etc/extra/httpd-xampp.conf中将一下内容屏蔽 (require local 前加#,注释掉)

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

4. 如果按照以上修改后,还是不能访问,则可能是防火墙把80端口给干掉了,要么把防火墙关闭,要么配置一下80端口允许访问。

  CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。

  a、关闭firewall:

    systemctl stop firewalld.service #停止firewall

    systemctl disable firewalld.service #禁止firewall开机启动

  b、安装iptables防火墙

    yum install iptables-services #安装

    vi /etc/sysconfig/iptables #编辑防火墙配置文件

    # Firewall configuration written by system-config-firewall

    # Manual customization of this file is not recommended.

    *filter

    :INPUT ACCEPT [0:0]

    :FORWARD ACCEPT [0:0]

    :OUTPUT ACCEPT [0:0]

    -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

          -A INPUT -p icmp -j ACCEPT

           -A INPUT -i lo -j ACCEPT

           -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

          -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

          -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

          -A INPUT -j REJECT --reject-with icmp-host-prohibited

          -A FORWARD -j REJECT --reject-with icmp-host-prohibited

         COMMIT

         :wq! #保存退出

         systemctl restart iptables.service #最后重启防火墙使配置生效

             systemctl enable iptables.service #设置防火墙开机启动

五.开机自启 lampp

$ vim /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

/opt/lampp/lampp restart

 六.卸载xampp

 

停止 XAMPP,只需输入如下命令:
/opt/lampp/lampp stop
您现在应该能看到:
Stopping LAMPP 1.7...
LAMPP: Stopping Apache...
LAMPP: Stopping MySQL...
LAMPP stopped.
然后 XAMPP 的 Linux 版就停止运行了。 想卸载 XAMPP,只需输入如下命令:
rm -rf /opt/lampp
卸载完成。:)


设置ftp密码:  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)

posted on 2016-12-07 17:39  x-sco  阅读(702)  评论(0编辑  收藏  举报

导航