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

Re: I *think* I found the apache2 docs, but it's in .html and Icannot getfirefox to access it using "file:"+ /path/to/filedir



On Wed 22 Jun 2022, at 18:22, gene heskett <gheskett@shentel.net> wrote:
> On 6/22/22 10:45, Gareth Evans wrote:
>>
>>> On 21 Jun 2022, at 22:37, Gareth Evans <donotspam@fastmail.fm> wrote:
>>>
>>> 
>>>
>>>> On 21 Jun 2022, at 22:12, Gareth Evans <donotspam@fastmail.fm> wrote:
>>>>
>>>> On Tue 21 Jun 2022, at 20:16, gene heskett <gheskett@shentel.net> wrote:
>>>>>> On 6/21/22 14:09, Gareth Evans wrote:
>>>>>> On Tue 21 Jun 2022, at 18:06, gene heskett <gheskett@shentel.net> wrote:
>>>>>>> On 6/21/22 12:11, Andrew M.A. Cater wrote:
>>>>>>>>> On Tue, Jun 21, 2022 at 11:55:56AM -0400, gene heskett wrote:
>>>>>>>>>> Greetings all;
>>>>>>>>>>
>>>>>>>>>> So how am I supposed to read these installed docs?
>>>>>>>>>>
>>>>>>>>>> Thanks all.
>>>>>>>>>>
>>>>>>>>>> Cheers, Gene Heskett.
>>>>>>>>>> -- 
>>>>>>>>>> "There are four boxes to be used in defense of liberty:
>>>>>>>>>>   soap, ballot, jury, and ammo. Please use in that order."
>>>>>>>>>> -Ed Howdershelt (Author, 1940)
>>>>>>>>>> If we desire respect for the law, we must first make the law respectable.
>>>>>>>>>>   - Louis D. Brandeis
>>>>>>>>>>
>>>>>>>>>>  From a web browser?
>>>>>>>>> file:///usr/share/doc/apache2-doc
>>>>>>>>>
>>>>>>>>> That's three slashes - file:// - two slashes - and then the filesystem path.
>>>>>>>>>
>>>>>>>>> Hope this helps, with every good wish, as ever,
>>>>>>>>>
>>>>>>>>> Andy Cater
>>>>>>>> And that works, the third slash is new to me.
>>>>>>>>
>>>>>>>> So now the only thing I've changed from the default install is in
>>>>>>>> /etc/apache2/envvars
>>>>>>>> for usr and grp to be www-data. But now it won't restart.
>>>>>>>> journalctl -xe reports:
>>>>>>>> Jun 21 12:46:16 coyote apachectl[286443]: AH00526: Syntax error on line
>>>>>>>> 63 of /etc/apache2/conf-enabled/security.conf:
>>>>>>>> Jun 21 12:46:16 coyote apachectl[286443]: Invalid command 'Header', [...]
>>>>>>> In my (unedited) version of that file:
>>>>>>>
>>>>>>> [...]
>>>>>>> 61 # Requires mod_headers to be enabled.
>>>>>>> 62 #
>>>>>>> 63 #Header set X-Content-Type-Options: "nosniff"
>>>>>>>
>>>>>>> If line 63 is required un-commented, then
>>>>>>>
>>>>>>> $ sudo a2enmod headers
>>>>>>> $ sudo systemctl restart apache2
>>>>>>>
>>>>>>> should do the trick.
>>>>> After I found it with locate/ /usr/sbin is not in su's $PATH
>>>>> That fixed the error, and I uncommented the stanza in apache2.conf
>>>>> that points to the directory I want the server to access, and
>>>>> localhost:port# displays the default startup page ok.
>>>>>
>>>>> dig "my-site-name" returns the proper ipv4 address.
>>>>> I just used the address:6309 and it worked. So I edited the
>>>>> address bar to use the registered name:6309 and hit F5,
>>>>> a couple times, and that works.
>>>> Do you see a page titled "Apache2 Debian Default Page" with the Debian logo?
> yes
>
>>>> If so it's probably configured in
>>>>
>>>> /etc/apache2/sites-available/000-default.conf
>>>>
>>>> or
>>>>
>>>> /etc/apache2/sites-available/default-ssl.conf for https version
> I'd like to get this working if possible.
>>>>
>>>> as Debian uses name-based virtual hosts with a config file structure which does not correspond to the Apache docs afaics, and I can't find any Debian docs on the subject.
>>>>
>>>> https://httpd.apache.org/docs/2.4/configuring.html
>>>> https://httpd.apache.org/docs/2.4/vhosts/
>>>>
>>>> 000-default is already enabled (though the other for https may not be) if you're seeing the page I referred to above.
>>>>
>>>> $ sudo a2ensite filename (without .conf)
>>>>
>>>> is the command you would use to enable an "available" configuration (which creates a symlink in ../sites-enabled),
> That much I got. But nowhere is the doc I've printed 10 pages of,
> is there an example of how to setup a local site. ISTR when I did
> this back in the fog of 2005 or so, that it was then all done in the
> html of the /var/www/gene/index.html. 

The default location now is

/var/www/html/

That should be the location of the "default page" index.html you are seeing.

If you move your content there, assuming you only run one site from the server, it should serve it.

Alternatively...

> Robots.txt was also there
> but most robots ignored it, so I got addresses out of log/oth* and
> added them to iptables rules with DROP commands. They move
> the bots around weekly so that's an hours work a day until I added
> a CIDR of /16 or so. Enough to cover that bots src address bundle.
>
> But there ought to be a better way, I only had apache2 live and
> serving the default page on that oddball port # about 10 minutes
> when a "petalbot" showed up in the log.
>
>>>
>>>> but you may find it easier just to edit the existing 000-default.conf file.

> Tried that <Directory path> listed here in that file as a second entry,
> but it had zero effect on an apache2 restart.

...I didn't mention documentroot which needs to change too.

You might like to try this (comments not reproduced, no opt-related directory stanza required in apache2.conf as long as it's specified here)

---
<VirtualHost *:80>

	ServerAdmin webmaster@localhost
	DocumentRoot /opt/what/ever/

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
	<Directory /opt/what/ever/>
		Options Indexes FollowSymLinks
		AllowOverride All
		Require all granted
	</Directory>
---

There can only be one

<VirtualHost *:80>

in all of the sites-enabled/*.conf files, which is served if no other virtualhost matches the incoming domain request (by the ServerName or ServerAlias).

So if you want to create another sitename.conf to serve from /opt and leave 000-default as it is, you will need to change your file to something like

<VirtualHost your-ip:80>
ServerName www.yourdomain.com
...
(rest as above)
...


>>> According to comments in my apache2.conf there needs to be a directory stanza there too for each directory not already declared which you want Apache to be able to access contents under.
>> Re-reading yesterdays emails it seems you have already established that, I was engrossed in figuring out where you might be in the process and lost track of what you had said.
>>
>> Your directory stanza looks OK to me, it just isn't enough on its own.
>>
>> Any progress?
>>
>> G
> No, I'm stuck looking at the default page.
>>>> You can create another (or iirc just extend it) if you want to add other (domain-)name-based sites in future.
>>>>
>>>> * in the virtualhost tag as in "*:portNo" means "all domains", so these would need to be specified if >1.
>>>>
>>>> This tutorial (amongst others I'm sure) explains the Debian approach:
>>>>
>>>> https://vitux.com/debian-apache/
>>>>
>>>> You may find that putting a suitable <VirtualHost> stanza around your directory stanza in apache2.conf works (eg. copy the relevant parts from 000-default), though I think you would at least need to disable 000-default if you do. For that:
>>>>
>>>> $ sudo a2dissite 000-default
>>>>
>>>> I think the most pain-free method is likely to be to edit or add to the files in
>>>> /etc/apache2/sites-available/
> That sounds doable. Is there an existing file that could be copied to
> geneslinuxbox and edited to accomplish that?  

Not that I know of.

000-default.conf gives the basic structure but not all the options.  

> I am amazed at the
> lack of examples in this distribution.
>
> Its also a compromised effort as the replacement lens in my right,
> master eye from cataract surgery several years ago has gotten foggy,
> effecting my ability to read t-birds fine print. So I'll do a ctl+ 2 or 
> 3 times,
> then print the original.
>>>> Hope that helps.
>>>> Gareth
> It should, thank you. I'll report later, after I've switched the stat for AC
> as its 89F@13:00 out, forecast for the mid 90's today.
>
> Thank you, take care & stay well.
>>>> So now I need a <Directory /path/to/dir> stanza in apache2.conf that works.
>>>> This one doesn't:
>>>> <Directory /opt/www/geneslinuxbox>
>>>>     Options Indexes FollowSymLinks
>>>>     AllowOverride None
>>>>     Require all granted
>>>> </Directory>
>>>>
>>>> Do I need to comment out the default page to expose mine?
>>>> I have constructed that path, made a subdir for buster armhf
>>>> stuff in it and placed an preempt-rt kernel file in it.
>
> Cheers, Gene Heskett.
> -- 
> "There are four boxes to be used in defense of liberty:
>   soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author, 1940)
> If we desire respect for the law, we must first make the law respectable.
>   - Louis D. Brandeis


Reply to: