S1:下载xampp
进入用户目录,创建文件,使用weget下载xampp到文件夹下
# wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/7.0.24/xampp-linux-x64-7.0.24-0-installer.run
S2:安装xampp
首选赋予安装文件可执行权限,执行命令:# chmod 777 xampp-linux-x64-7.0.24-0-installer.run
运行:./xampp-linux-x64-7.0.24-0-installer.run 进行安装操作。根据提示进行安装即可,不熟悉的话可以按照默认选择yes一直下去。
看到100%说明安装成功。
安装完成之后的,目录在 /opt/lampp
常见的lampp命令
启动xampp:
# /opt/lampp/lampp start
停止xampp:
# /opt/lampp/lampp stop
重启xampp
# /opt/lampp/lampp restart
S3:设置相关密码
执行命令# /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.
设置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):
S4:修改外网访问权限
找到配置文件:
/opt/lampp/etc/extra/httpd-xampp.conf
修改17行的内容如下:
# since XAMPP 1.4.3
<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Require all granted
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
S5:修改MYsql外网访问权限
这步折腾了我好久,原因是没注释掉my.cnf的 skip networking,导致怎么外网访问都不行。
执行命令
#/opt/lampp/bin/mysql -u root -p
Enter password:
切换数据库
mysql> use mysql;
修改外网访问
查看用户
select host ,user from user;
//赋予任何主机访问数据的权限
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
//使修改生效
mysql>FLUSH PRIVILEGES;
重启mysql,问题解决。
S5:配置反向代理
修改/opt/lampp/etc/httpd.conf
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
开启反向代理
修改代理配置文件/opt/lampp/etc/extra/httpd-vhosts.conf
//按照如下配置换一下IP和域名
<VirtualHost *:80>
ServerName 101.101.161.133
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://101.101.161.133:8080/
ProxyPassReverse / http://101.101.161.133:8080/
ErrorLog logs/smart119_error_log
CustomLog logs/smart119_custom_log common
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot "/opt/lampp/docs/dummy-host.example.com"
# ServerName dummy-host.example.com
# ServerAlias www.dummy-host.example.com
# ErrorLog "logs/dummy-host.example.com-error_log"
# CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerName abc.rleit.com
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://101.101.161.133:8080/
ProxyPassReverse / http://101.101.161.133:8080/
ErrorLog logs/smart119_error_log
CustomLog logs/smart119_custom_log common
# ServerAdmin webmaster@dummy-host2.example.com
# 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>