how to configuring a xampp web server for different root directory

后端 未结 10 1906
予麋鹿
予麋鹿 2020-12-02 07:17

The web directory is the home of all of your application\'s public and static files. Including images, stylesheets and JavaScript files. It is also where the front controlle

相关标签:
10条回答
  • 2020-12-02 07:37

    For XAMMP versions >=7.5.9-0 also change the DocumentRoot in file "/opt/lampp/etc/extra/httpd-ssl.conf" accordingly.

    0 讨论(0)
  • 2020-12-02 07:38

    You can change Apaches httpd.conf by clicking (in xampp control panel) apache/conf/httpd.conf and adjust the entries for DocumentRoot and the corresponding Directory entry. Just Ctrl+F for "htdocs" and change the entries to your new path.

    See screenshot:

    #
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    DocumentRoot "C:/xampp/htdocs"
    <Directory "C:/xampp/htdocs">
    
    0 讨论(0)
  • 2020-12-02 07:38

    I moved my htdocs folder from C:\xampp\htdocs to D:\htdocs without editing the Apache config file (httpd.conf).

    Step 1) Move C:\xampp\htdocs folder to D:\htdocs Step 2) Create a symbolic link in C:\xampp\htdocs linked to D:\htdocs using mklink command.

    D:\>mklink /J C:\xampp\htdocs D:\htdocs
    Junction created for C:\xampp\htdocs <<===>> D:\htdocs
    
    D:\>
    

    Step 3) Done!

    0 讨论(0)
  • 2020-12-02 07:38

    You can change the port while you open your XAMP control panel, follow the steps:

    1. click on config net to the start button, and
    2. select httpd.conf, a text file will open
    3. check the file and file listen:80,
    4. once got listen:80 replace with listen:8080 and
    5. save in the same folder.

    Once done that, you will be able to start your local server.

    0 讨论(0)
  • 2020-12-02 07:40

    In case, if anyone prefers a simpler solution, especially on Linux (e.g. Ubuntu), a very easy way out is to create a symbolic link to the intended folder in the htdocs folder. For example, if I want to be able to serve files from a folder called "/home/some/projects/testserver/" and my htdocs is located in "/opt/lampp/htdocs/". Just create a symbolic link like so:

    ln -s /home/some/projects/testserver /opt/lampp/htdocs/testserver
    

    The command for symbolic link works like so: ln -s target source where,

    target - The existing file/directory you would like to link TO.
    source - The file/folder to be created, copying the contents of the target. The LINK itself.
    

    For more help see ln --help Source: Create Symbolic Links in Ubuntu

    And that's done. just visit http://localhost/testserver/ In fact, you don't even need to restart your server.

    0 讨论(0)
  • 2020-12-02 07:48
    • Go to C:\xampp\apache\conf\httpd.conf
    • Open httpd.conf
    • Find tag : DocumentRoot "C:/xampp/htdocs"
    • Edit tag to : DocumentRoot "C:/xampp/htdocs/myproject/web"
    • Now find tag and change it to < Directory "C:/xampp/htdocs/myproject/web" >

    • Restart Your Apache

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