XAMPP部署站点问题记录

       偶尔需要使用xampp部署php站点,因此把部署碰到的问题做个记录。

问题1:80和443端口被占用问题

解决方案是把这两个端口更换为其他没有被占用的端口 :我是把80改为8080,443改为4431

1:使用 netstat 查看已经被占用的端口

2:更改80端口

点击apache 的config 选择apache(httpd.conf

查找:Listen 80  修改为 Listen 8080

查找:ServerName localhost:80 修改为 ServerName localhost:8080

 

3:更改443端口

点击apache中config 选择apache(httpd-ssl.conf)

查找 Listen 443 修改为 Listen 4431

4:其他地方的修改

   4.1: xampp 安装目录下 properties.ini 文件 使用记事本打开

  查找

  apache_server_port=80
  apache_server_ssl_port=443

  改为

  apache_server_port=8080
  apache_server_ssl_port=4431

  4.2:xampp 安装目录下xampp-control.ini文件 使用记事本打开

  查找

  Apache=80
  ApacheSSL=443

  改为

  Apache=8080
  ApacheSSL=4431

  4.3: 点击xampp控制面板右上方的config

 选择服务和端口设置

把端口改为8080和4431 之后保存

5:启动apache即可

问题2:xampp配置多个站点

1:安装目录下查找文件/xampp/apache/conf/extra/httpd-vhosts.conf

2:把NameVirtualHost *:80前面的#号去除掉 因为我改掉了端口改为NameVirtualHost *:8080

3:

在文件的底部增加:

#站点1
<VirtualHost *:8080>
 DocumentRoot "D:/software/xampp/htdocs/web1"
 ServerName www.web1.com
</VirtualHost>

#站点2
<VirtualHost *:8080>
 DocumentRoot "D:/software/xampp/htdocs/web2"
 ServerName www.web2.com
</VirtualHost>

4:重启apache

5:把web1 和web2域名解析到对应的服务器,  如果是本地则修改hosts文件(win7系统路径:C:\Windows\System32\drivers\etc)

     用记事本打开添加

    127.0.0.1  www.web1.com

    127.0.0.1  www.web2.com

 

问题3:xampp中mysql 默认密码修改

    1: 进入phpmyadmin 选择mysql 数据库 执行下面语句     

  UPDATE user SET password=PASSWORD('newpassword') WHERE user='root';
     即:把root密码改为了newpassword
   
     2.phpmyadmin 配置中密码也需要修改
        2.1 查找文件 \xampp\phpMyAdmin\config.inc.php
        2.2  更改密码
       Authentication type and info */$cfg['Servers'][$i]['auth_type']
      = 'config';$cfg['Servers'][$i]['user']
      = 'root';$cfg['Servers'][$i]['password']
      = '';$cfg['Servers'][$i]['extension']
      = 'mysql';$cfg['Servers'][$i]['AllowNoPassword']
      = true;
      改为对应的密码
      Authentication type and info */$cfg['Servers'][$i]['auth_type']
      = 'config';$cfg['Servers'][$i]['user']
      = 'root';$cfg['Servers'][$i]['password']
      = 'newpassword';$cfg['Servers'][$i]['extension']
      = 'mysql';$cfg['Servers'][$i]['AllowNoPassword']
      = true;
 

 

 

 

 

 

posted @ 2017-06-28 15:31  浅酌小酒  阅读(286)  评论(0编辑  收藏  举报