一, 熟悉一下XAMPP常用知识点
新安装的XAMPP并不适用于生产环境,而仅供开发环境使用, 所以需要加强安全设置
#/opt/lampp/lampp security
此命令会设置如下安全问题:
1,MySQL管理员(root)没有密码。
2,MySQL可通过网络访问。
3,ProFTPD使用“xampp”作为用户名“deamon”的密码。
4,PhpMyAdmin可以通过网络访问。
高级的启动与停止参数
#/opt/lampp/lampp start 启动 XAMPP。
#/opt/lampp/lampp stop 停止 XAMPP。
#/opt/lampp/lampp restart 重新启动XAMPP。
#/opt/lampp/lampp startapache 只启动Apache。
#/opt/lampp/lampp stopapache 停止 Apache。
#/opt/lampp/lampp startssl 启动Apache的SSL支持,关闭/重新启动XAMPP,SSL仍将处激活状态。
#/opt/lampp/lampp stopssl 停止Apache的SSL支持。关闭/重新启动XAMPP,SSL仍将处停止状态。
#/opt/lampp/lampp startmysql 只启动MySQL 数据库。
#/opt/lampp/lampp stopmysql 停止MySQL 数据库。
#/opt/lampp/lampp startftp 启动ProFTPD服务器。关闭/重新启动XAMPP,FTP仍将处激活状态。
#/opt/lampp/lampp stopftp 停ProFTPD服务器。关闭/重新启动XAMPP,FTP仍将处停止状态。
#/opt/lampp/lampp security 启动一个小型安全检查程序。
文件/目录/用途
/opt/lampp/bin/ XAMPP命令库
/opt/lampp/htdocs/ Apache文档根目录。
/opt/lampp/etc/httpd.conf Apache配制文件。
/opt/lampp/etc/my.cnf MySQL配制文件。
/opt/lampp/etc/php.ini PHP配制文件。
/opt/lampp/etc/proftpd.conf ProFTPD配制文件。
/opt/lampp/phpmyadmin/config.inc.php phpMyAdmin 配制文件。
卸载XAMPP
#rm -rf /opt/lampp
卸载完成。:)
再次修改XAMPP中默认的daemon的密码
# daemon gets the password "xampp" # commented out by xampp security #UserPassword daemon 2TgxE8g184G9c UserPassword daemon 2TgxE8g184G9c
先恢复daemon的默认密码为xampp,然后执行security密令修改密码
#/opt/lampp/lampp security
问题修复
XAMPP访问出现New XAMPP security concept
解决方法:
打开httpd-xampp.conf(/opt/lampp/etc/extra/)
注:Deny from all注释掉,变成: #Deny from all
注:需要重启apache[/opt/lampp/lampp restartapache]
二, Namecheap SSL证书的购买
购买
Namecheap官网 https://www.namecheap.com/
首先注册Namecheap账号,如实填写即可。
Namecheap SSL证书激活
点击用户名选择 Manage SSL Certificate 看到自己购买的证书,点击Activate Now
在Linux服务器上准备生成csr
打开putty,执行以下命令:
#openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr
填写内容如下:
You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:CN // 国家,一定是CN State or Province Name (full name) [Some-State]:Beijing // 省份 Locality Name (eg, city) []:Beijing // 城市 Organization Name (eg, company) [Internet Widgits Pty Ltd]:xxxx // 组织名称或公司名称(随便) Organizational Unit Name (eg, section) []: // 可不填 Common Name (e.g. server FQDN or YOUR name) []:xxx.com // 注意一定要填写需要申请ssl的域名 Email Address []:xxx@gmail.com // 电子邮件地址 Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: // 可不填,直接回车 An optional company name []: // 可不填,直接回车
填写完成之后,会得到 server.key 、 server.csr 两个文件。
将这两个文件保存至本地、保存,以后还会用到。
打开server.csr,复制文件内的所有内容。
在 Select web server 选择你的服务器,在下拉菜单选择含有Apache/Nginx的选项,
之后,在下面 Enter csr 输入在服务器上生成的csr(即刚复制的内容)。
接着可以选中HTTP验证方式, 去下载验证文件, 在网站根目录下创建如下文件夹
YOUR SITE WWW DIRECTORY/.well-known/pki-validation/validation.txt
如果有多个域名, 需要在每个站点下传验证文件
1个小时左右会收到”Your PositiveSSL Multi-Domain Certificate”邮件, 下载里面有类似如下文件:
如果收到的CA certificates像这样AddTrustExternalCARoot.crt, COMODORSAAddTrustCA.crt and COMODORSADomainValidationSecureServerCA.crt
使用命令合并它们:
#cat COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt >> bundle.crt
Complete VirtualHost record for port 443 may look like the one below:
Listen 443 DocumentRoot "/opt/lampp/htcdocs/yoursitedirectory/" ServerName *your_domain_name* SSLEngine on SSLCertificateFile "/opt/lampp/etc/ssl.crt/yoursitename.crt" SSLCertificateKeyFile "/opt/lampp/etc/ssl.key/server.key" SSLCACertificateFile "/opt/lampp/etc/ssl.crt/yoursitename.ca-bundle"
最后重启apache
Name Cheap 官网手册: https://www.namecheap.com/support/knowledgebase/article.aspx/9446/0/apache-opensslmodsslnginx
相关文章: Nginx 配置SSL证书 + 搭建HTTPS网站 Startssl SSL 证书申请图解
其他注意事项:
1, 如果第三方证书有p7b文件, 它是在Windows平台使用, ca-bundle和crt使用在Linux平台下即可
2, 多个站点的SSL配置, 在httpd-ssl.conf里再增加一个如下配置即可, 除域名外,证书等和默认的HTTP站点一样
DocumentRoot "/opt/lampp/htdocs/yoursite" ServerName beta.yoursite.com:443 ServerAdmin adminbeta@yoursite.com ErrorLog "/opt/lampp/logs/ssl_error_beta_log" TransferLog "/opt/lampp/logs/ssl_access_beta_log" SSLEngine on SSLCertificateFile "/opt/lampp/etc/ssl.crt/dearlives_com.crt" SSLCertificateKeyFile "/opt/lampp/etc/ssl.key/server.key" SSLCACertificateFile "/opt/lampp/etc/ssl.crt/dearlives_com.ca-bundle" <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars <Directory "/opt/lampp/cgi-bin"> SSLOptions +StdEnvVars BrowserMatch "MSIE [2-5]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 CustomLog "/opt/lampp/logs/ssl_request_log" \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
最新评论
kali下用到的临时命令: smb//192.168.1.117 sudo mount -t cifs //192.168.1.117/Downloads /mnt -o username=niu