准备工作,登录系统
ssh 服务器ip地址 -l root
1,下载xampp
wget https://www.apachefriends.org/xampp-files/7.2.9/xampp-linux-x64-7.2.9-0-installer.run
2,安装xampp
2-1 改变文件权限为可执行
chmod 777 xampp-linux-x64-7.2.9-0-installer.run
2-2安装xampp
./xampp-linux-x64-7.2.9-0-installer.run
3,确认网站可访问
* 安全策略出入规则是否开放访问端口
* 是否有防火墙开启
* 服务是否正常启动 ./lampp status
4,配置ftp
4-1,添加用户组
groupadd 用户组名
4-2,添加用户
useradd -d /opt/lampp/www/elan -g 用户组名 -s /sbin/nologin 用户名
useradd -d /opt/lampp/www/xyl -g 用户组名 -s /sbin/nologin 用户名
4-3 创建用户密码
passwd 用户名
密码:密码
5,修改www目录下的访问权限
chmod -R 777 /opt/lampp/www/elan
chmod -R 777 /opt/lampp/www/xyl
备注:删除帐户的命令是userdel,修改帐户的命令是usermod,存储帐户的文件路径为/etc/passwd。
6,修改defaultRoot
vi /opt/lampp/etc/proftpd.conf
---------------------------------------
# only for the web servers content
DefaultRoot /opt/lampp/www
<Limit SITE_CHMOD>
DenyAll
</Limit>
<Limit LOGIN>
DenyAll
AllowGroup ftpusers
</Limit>
<Directory /opt/lampp/www/*>
<Limit ALL>
DenyAll
</Limit>
</Directory>
<Directory /opt/lampp/www/elan>
<Limit ALL>
DenyAll
AllowUser elanftp
</Limit>
</Directory>
<Directory /opt/lampp/www/xyl>
<Limit ALL>
DenyAll
AllowUser xylftp
</Limit>
</Directory>
# daemon gets the password "xampp"
UserPassword daemon 2TgxE8g184G9c
# daemon is no normal user so we have to allow users with no real shell
RequireValidShell off
# daemon may be in /etc/ftpusers so we also have to ignore this file
UseFtpUsers off
DefaultRoot ~
--------------------------------------
7,配置虚拟主机
7-1修改配置文件
vi /opt/lampp/etc/httpd.conf
注释掉下面内容
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
7-2,编辑虚拟主机文件
vi etc/extra/httpd-vhosts.conf
------------------------------------------------
<VirtualHost *:80>
ServerAdmin dalian234@sina.com
DocumentRoot "/opt/lampp/www/hanying"
ServerName m.hanying.com
ServerAlias m.hanying.com
ErrorLog "logs/hanying-error_log"
CustomLog "logs/hanying-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin dalian234@sina.com
DocumentRoot "/opt/lampp/www/elan"
ServerName app.elan-fashion.com
ServerAlias app.elan-fashion.com
ErrorLog "logs/elan-error_log"
CustomLog "logs/elan-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin dalian234@sina.com
DocumentRoot "/opt/lampp/www/xyl"
ServerName m.xiaoyulangfood.com
ErrorLog "logs/xyl-error_log"
CustomLog "logs/xyl-access_log" common
</VirtualHost>
8,编辑httpd文件,配置访问权限
vi etc/httpd.conf
------------------------------------------
DocumentRoot "/opt/lampp/www"
<Directory "/opt/lampp/www">
9,ftp连接测试
* Encryption 使用 Only use plain FTP
* Transfer mode 使用 Active
10,配置ssl证书
10-1 到https://freessl.org获取免费ssl证书
10-2 在域名控制做域名解析
10-3 服务器配置
*停不掉apache可以删除文件 /opt/lampp/logs# rm httpd.pid
*安全组策略 443端口是否打开
10-4设置多个虚拟主机
*ServerName 需要制定具体域名
---------------------------------------------------
NameVirtualHost *:443
SSLStrictSNIVHostCheck off
<VirtualHost _default_:443>
# General setup for the virtual host
DocumentRoot "/opt/lampp/www/luo"
ServerName m.luoluo.store:443
ServerAdmin dalian234@sina.com
ErrorLog "/opt/lampp/logs/xyl/error_log"
TransferLog "/opt/lampp/logs/xyl/access_log"
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
# Server Certificate:
SSLCertificateFile "/opt/lampp/etc/cert/xyl/full_chain.pem"
# Server Private Key:
SSLCertificateKeyFile "/opt/lampp/etc/cert/xyl/private.key"
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/opt/lampp/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# Per-Server Logging:
# The home of a custom SSL log file. Use this when you want a
# compact non-error SSL logfile on a virtual host basis.
CustomLog "/opt/lampp/logs/ssl_request_log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>