[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Treate .sh and .bash the same way Apache2

On 10/22/2019 5:13 PM, Dan Ritter wrote:
> john doe wrote:
>> On 10/22/2019 4:20 PM, Dan Ritter wrote:
>>> john doe wrote:
>>>> Hi,
>>>> I'm using Apache2 on Debian (Stretch 9) and trying to have the .bash
>>>> extension treated like the .sh extension:
>>>> For now, I have modified the file
>>>> /etc/apache2/mods-availables/autoindex.conf byt adding .bash to the
>>>> following line:
>>>>         AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl .bash
>>>> The file with the .bash extension is not treated like it is for .sh
>>>> (everything is working fine for the .sh), what am I missing?
>>>> In other words, how should Apache2 be configured to make no difference
>>>> between .sh and .bash extension.
>>> You say "treated like" but the config you have is just for what
>>> icons are shown in file listings.
>>> Is that what's going wrong?
>> Yes, along with that if I click on a .sh file I get prompted to
>> download/open the file but if I click on a .bash file I can read the
>> file in the browser.
> Right, that's a completely separate thing.
> The config you want is something like:
> /etc/mime.types:
> application/x-shellscript       .sh .shar .bash
> and then run
>  a2enmod mime
> And if you haven't enabled autoindex.conf,
>  a2enmod autoindex

Following the line for sh in the instructed file:

text/x-sh     sh

I went for:

text/x-bash     bash

I just saw your answer, the following in
'/etc/apache2/mods-available/autoindex.conf' does it as well:

AddType text/plain .bash

Next step is to figure out how to do the same for file that don't have
an extension that I can use but they always start with the same pattern:


Thanks for the help DSR, you got me rolling! :)

John Doe

Reply to: