How do I test a website using XAMPP?

后端 未结 5 1511
失恋的感觉
失恋的感觉 2021-01-30 04:16

This is a fairly general query as I\'m very confused about how to do this. I want to use the apache server which I have downloaded as part of XAMPP in order to test the website

相关标签:
5条回答
  • 2021-01-30 04:55

    Just make a new folder inside C:\xampp\htdocs like C:\xampp\htdocs\test and place your index.php or whatever file in it. Access it by browsing localhost/test/

    Good luck!

    0 讨论(0)
  • 2021-01-30 04:55

    create a folder inside htdocs, place your website there, access it via localhost or Internal IP (if you're behind a router) - check out this video demo here

    0 讨论(0)
  • 2021-01-30 04:57

    The webpages on an online server reside in a location which looks somewhat like this: http://www.somerandomsite.com/index.php

    Since xampp is Offline, it sets up a local server whose address is like this http://localhost/

    Basically, xampp sets up a server (apache and others) in your system. And all the files such as index.php, somethingelse.php, etc., reside in the xampp\htdocs\ folder.

    The browser locates the server in localhost and will search through the above folder for any resources available in there.

    So create any number of folders inside the "xampp\htdocs\" each folder thus forming a website (as you build it).

    Sometimes apache won't even start. This is due to the clashing of ports with some applications. Some of them I commonly encounter is Skype. See to that it is killed completely and restart apache

    0 讨论(0)
  • 2021-01-30 04:57

    Just edit the httpd-vhost-conf scroll to the bottom and on the last example/demo for creating a virtual host, remove the hash-tags for DocumentRoot and ServerName. You may have hash-tags just before the <VirtualHost *.80> and </VirtualHost>

    After DocumentRoot, just add the path to your web-docs ... and add your domain-name after ServerNmane

    <VirtualHost *:80>
        ##ServerAdmin webmaster@dummy-host2.example.com
        DocumentRoot "C:/xampp/htdocs/www"
        ServerName example.com
        ##ErrorLog "logs/dummy-host2.example.com-error.log"
        ##CustomLog "logs/dummy-host2.example.com-access.log" common
    </VirtualHost>
    

    Be sure to create the www folder under htdocs. You do not have to name the folder www but I did just to be simple about it. Be sure to restart Apache and bang! you can now store files in the newly created directory. To test things out just create a simple index.html or index.php file and place in the www folder, then go to your browser and test it out localhost/ ... Note: if your server is serving php files over html then remember to add localhost/index.html if the html file is the one you choose to use for this test.

    Something I should add, in order to still have access to the xampp homepage then you will need to create another VirtualHost. To do this just add

    <VirtualHost *:80>
        ##ServerAdmin webmaster@dummy-host2.example.com
        DocumentRoot "C:/xampp/htdocs"
        ServerName htdocs.example.com
        ##ErrorLog "logs/dummy-host2.example.com-error.log"
        ##CustomLog "logs/dummy-host2.example.com-access.log" common
    </VirtualHost>
    

    underneath the last VirtualHost that you created. Next make the necessary changes to your host file and restart Apache. Now go to your browser and visit htdocs.example.com and your all set.

    0 讨论(0)
  • 2021-01-30 04:57

    Make a new folder inside htdocs and access it in browser.Like this or this. Always start Apache when you start working or check whether it has started (in Control panel of xampp).

    0 讨论(0)
提交回复
热议问题