• <i id='CHuoK'><tr id='CHuoK'><dt id='CHuoK'><q id='CHuoK'><span id='CHuoK'><b id='CHuoK'><form id='CHuoK'><ins id='CHuoK'></ins><ul id='CHuoK'></ul><sub id='CHuoK'></sub></form><legend id='CHuoK'></legend><bdo id='CHuoK'><pre id='CHuoK'><center id='CHuoK'></center></pre></bdo></b><th id='CHuoK'></th></span></q></dt></tr></i><div id='CHuoK'><tfoot id='CHuoK'></tfoot><dl id='CHuoK'><fieldset id='CHuoK'></fieldset></dl></div>
      <bdo id='CHuoK'></bdo><ul id='CHuoK'></ul>
    <legend id='CHuoK'><style id='CHuoK'><dir id='CHuoK'><q id='CHuoK'></q></dir></style></legend>

  • <tfoot id='CHuoK'></tfoot>

    <small id='CHuoK'></small><noframes id='CHuoK'>

      1. 在xampp中使用域名而不是localhost

        时间:2024-04-12
          <i id='v5n9I'><tr id='v5n9I'><dt id='v5n9I'><q id='v5n9I'><span id='v5n9I'><b id='v5n9I'><form id='v5n9I'><ins id='v5n9I'></ins><ul id='v5n9I'></ul><sub id='v5n9I'></sub></form><legend id='v5n9I'></legend><bdo id='v5n9I'><pre id='v5n9I'><center id='v5n9I'></center></pre></bdo></b><th id='v5n9I'></th></span></q></dt></tr></i><div id='v5n9I'><tfoot id='v5n9I'></tfoot><dl id='v5n9I'><fieldset id='v5n9I'></fieldset></dl></div>
            <tbody id='v5n9I'></tbody>
        1. <small id='v5n9I'></small><noframes id='v5n9I'>

        2. <tfoot id='v5n9I'></tfoot>

              <bdo id='v5n9I'></bdo><ul id='v5n9I'></ul>
                  <legend id='v5n9I'><style id='v5n9I'><dir id='v5n9I'><q id='v5n9I'></q></dir></style></legend>
                • 本文介绍了在xampp中使用域名而不是localhost的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的问题可能很愚蠢,但老实说,我搜索了很多并获得了成功但并不完整.

                  My question may be stupid, But honestly I searched a lot and got success but not complete.

                  我在 Windows 8 中使用 xampp.

                  I use xampp with windows 8.

                  我的主机文件如下所示.

                  My host file looks as follows.

                      127.0.0.1   localhost
                      127.0.0.1   www.mysite.com
                  

                  我的 httpd-vhosts.config 如下所示.

                  My httpd-vhosts.config looks as follows.

                      NameVirtualHost 127.0.0.1
                      <VirtualHost 127.0.0.1>
                          DocumentRoot "C:/xampp/htdocs"
                          ServerName localhost
                      </VirtualHost>
                      <VirtualHost 127.0.0.1>
                          ServerName www.mysite.com
                          ServerAlias mysite.com
                          DocumentRoot "C:/xampp/htdocs/mysite"
                      </VirtualHost>
                  

                  这非常适合 http.但我启用了 ssl.

                  This works perfect for http. But I have enabled ssl.

                  当我输入 http://localhosthttps://localhost 时,两者都可以正常工作.

                  When I type http://localhost or https://localhost, Both work fine.

                  当我输入 http://mysite.com 就可以了,

                  When I type http://mysite.com it works,

                  当我输入 https://mysite.com 时,它被重定向为 https://mysite.com/xampp/ 并显示 xampp 的默认欢迎页面.

                  when I type https://mysite.com it is redirected as https://mysite.com/xampp/ and shows me default welcome page of xampp.

                  我尝试了以下事情.

                  1) 我没有使用 127.0.0.1,而是尝试在 httpd-vhosts.conf 中使用 *:80 但结果相同.

                  1) instead of using 127.0.0.1, I tried using *:80 in httpd-vhosts.conf But result was same.

                  2) 我没有使用 127.0.0.1,而是尝试在 httpd-vhosts.conf 中使用 *:443 但是在重新启动时 apache 无法再次启动.

                  2) instead of using 127.0.0.1, I tried using *:443 in httpd-vhosts.conf But at the time of restarting apache fails to start again.

                  请告诉我如何通过域名而不是使用 https 或 http 的 localhost 访问我的网站.

                  Please let me know how can I access my site through domain name instead of localhost with https or http.

                  推荐答案

                  我尝试了很多东西,但我想我错过了基本的编辑.

                  I tried many things, But I think I missed basic edit.

                  现在一切正常.

                  现在主机文件仍然与问题中提到的相同.我没有对其进行任何更改.

                  Now host file is still the same as mentioned in question. I did not make any changes to it.

                  我在 httpd-vhosts.config 中更改了端口,如下所示.

                  I changed port in httpd-vhosts.config as shows below.

                  NameVirtualHost *
                      <VirtualHost *>
                          DocumentRoot "C:/xampp/htdocs"
                          ServerName localhost
                      </VirtualHost>
                      <VirtualHost *>
                          ServerName www.mysite.com
                          ServerAlias mysite.com
                          DocumentRoot "C:/xampp/htdocs/mysite"
                      </VirtualHost>
                  

                  另外我错过的步骤是在 httpd-vhosts.config 的同一文件夹中编辑 httpd-ssl.config 文件.

                  Also the step I missed, was editing httpd-ssl.config file in same folder that of httpd-vhosts.config.

                  我刚刚在 http-ssl.config 文件的最后一行之前添加了以下行,即 </IfModule>

                  I just added following lines before last line of http-ssl.config file i.e. < /IfModule>

                  <VirtualHost _default_:443> 
                      DocumentRoot "C:/xampp/htdocs/mysite" 
                      ServerName www.mysite.com:443 
                      ServerAlias mysite.com:443  
                      SSLEngine on 
                      SSLCertificateFile "conf/ssl.crt/server.crt" 
                      SSLCertificateKeyFile "conf/ssl.key/server.key" 
                  </VirtualHost> 
                  

                  感谢所有朋友在这方面为我提供了很多帮助,如果没有您的链接,我将永远无法发现我需要再编辑一个文件.

                  Thank You all friends for helping me lot on this, Without your links I would never ever be able to find out that I need to edit one more file.

                  这篇关于在xampp中使用域名而不是localhost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Windows 7 上的 XAMPP 中更改 php 写入权限 下一篇:“无法打开进程"正在使用 XAMPP 端口 80PID 4

                  相关文章

                      <bdo id='jALpc'></bdo><ul id='jALpc'></ul>
                  1. <i id='jALpc'><tr id='jALpc'><dt id='jALpc'><q id='jALpc'><span id='jALpc'><b id='jALpc'><form id='jALpc'><ins id='jALpc'></ins><ul id='jALpc'></ul><sub id='jALpc'></sub></form><legend id='jALpc'></legend><bdo id='jALpc'><pre id='jALpc'><center id='jALpc'></center></pre></bdo></b><th id='jALpc'></th></span></q></dt></tr></i><div id='jALpc'><tfoot id='jALpc'></tfoot><dl id='jALpc'><fieldset id='jALpc'></fieldset></dl></div>
                    <tfoot id='jALpc'></tfoot>
                  2. <small id='jALpc'></small><noframes id='jALpc'>

                    1. <legend id='jALpc'><style id='jALpc'><dir id='jALpc'><q id='jALpc'></q></dir></style></legend>