Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Solved Is it possible to give PHP apps precedence over HTML pages?

    LAMP
    2
    4
    143
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dfoy last edited by

      I have limited experience setting up LAMP, and what I know I learned from DigitalOcean tutorials.
      One of their tutorials includes this on editing the DirectoryIndex directive in mods-enabled/dir.conf:

      /etc/apache2/mods-enabled/dir.conf
      <IfModule mod_dir.c>
      DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
      </IfModule>

      By moving "index.php" to the first position in the DirectoryIndex directive, I can cause index.PHP to run as the default rather than index.HTML.

      I realize I can just remove index.HTML if I want index.PHP to be the file that runs, but I wonder, is it possible for me to edit a DirectoryIndex directive somewhere, as per the tutorial?

      That would let me keep an index.HTML file on the site as a fallback in case PHP failed (unlikely, but surely possible).

      girish 2 Replies Last reply Reply Quote 0
      • girish
        girish Staff @dfoy last edited by

        @dfoy Is this with the LAMP app on Cloudron (or some other app) ?

        1 Reply Last reply Reply Quote 0
        • girish
          girish Staff @dfoy last edited by

          @dfoy You can add custom apache configuration in app.conf using the file manager - https://docs.cloudron.io/apps/lamp/#apache-settings . I put the following line in app.conf inside the VirtualHost directive:

          <VirtualHost *:80>
             ...
              DirectoryIndex index.cgi index.pl index.php index.xhtml index.htm index.html
          
          </VirtualHost>
          
          

          And then restarted the app. I can confirm that php loads first before the html.

          D 1 Reply Last reply Reply Quote 3
          • D
            dfoy @girish last edited by

            @girish Thanks!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB