Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Apache2 Web Server Help, Please

Apache2 Web Server Help, Please
Thread Tools
ghporter
Administrator
Join Date: Apr 2001
Location: San Antonio TX USA
Status: Offline
Reply With Quote
Aug 15, 2023, 03:33 PM
 
I'm trying to get my Linux (Debian) machine to serve files via Apache on my LAN. However trying to use the documentation to figure out one specific issue has me running in circles.

By default, web content for Apache to serve is in Linux's /var/web/html folder. However, since I have /var in a separate partition that isn't huge, I want to have links in the index.html file point to files outside of the /var folder.

I can create those links and open index.html from the desktop (NOT through Apache) and the links actually work. But when I try those links through Apache's web server, the links fail with a 400 error.

I'd appreciate any pointers, explanations, examples, etc. on this. It's frustrating the heck out of me.

Glenn -----OTR/L, MOT, Tx
     
reader50
Administrator
Join Date: Jun 2000
Location: California
Status: Offline
Reply With Quote
Aug 15, 2023, 03:45 PM
 
Probably the simplest solution is to move your DocRoot to a different location. Then serve it all from a partition you have lots of space in.

/etc/apache2/httpd.conf (Apache2 config file)
Search for "DocumentRoot", the location is also given in "<Directory ..." which is right below DocRoot in my (Mac) Apache2 config file. Point them both to your new site location. Also check for the CGI-Executables pointers. May not apply to your site, but better to re-point everything.

Copy across your site files from the usual location. They might need a little permissions fiddling, or might work out of the box. Depends on if your copy program copied the permissions across too.
     
ghporter  (op)
Administrator
Join Date: Apr 2001
Location: San Antonio TX USA
Status: Offline
Reply With Quote
Aug 15, 2023, 05:17 PM
 
DocumentRoot is in a different place in Linux, under the Sites Enabled folder in a "default.conf" file. Once I finally found that, I changed my root to a folder in a different (larger) partition, and stuff started working.

Thanks!

Glenn -----OTR/L, MOT, Tx
     
ghporter  (op)
Administrator
Join Date: Apr 2001
Location: San Antonio TX USA
Status: Offline
Reply With Quote
Aug 15, 2023, 08:12 PM
 
One thing: the Apache documentation is really strong, well written, and extensive. But if you just search for “DocumentRoot”, it’ll give you everything but where the heck is this directive!?!?!##$%%”.

As a tech writer (among other things), I can’t understand how such well written documentation could be so lacking in subject-specific context. I somehow doubt it would have injured the writers if they’d have just put a “back path” of some sort at the top of each directive page. Ya know?

Glenn -----OTR/L, MOT, Tx
     
ghporter  (op)
Administrator
Join Date: Apr 2001
Location: San Antonio TX USA
Status: Offline
Reply With Quote
Aug 18, 2023, 10:10 AM
 
Just a follow up: now that I can put my files where I want them, I’ve been learning CSS (I only had an intro the last time I did any web work), and I’m making nice progress. It really is a time and work saver, even though it feels like I’m mixing HTML and Java/C syntax.

The reason for an internal web server is to avoid new hardware and software while still sharing (mostly) photos across the LAN. Yeah, I could set up a Plex server, yeah, I could buy a big old NAS and have Plex serve everything up, yeah, I could spend the next couple of weeks learning how to configure the server and the clients for MacOS, iOS/iPadOS, Linux and Windows so they can see and interact with the server….

But why, when I’m not talking about streaming the latest Phineas and Furb to my iPhone, etc.? Every device has a capable web browser, every device can open JPEGs and MP4s (home-grown kitten videos are a lot of fun), and so on. HTML/CSS is useful everywhere, while Plex and its kin are pretty specialized. I have always worked at being a generalist first, and adding to my HTML skills is quite a bit simpler than learning something completely new.

Glenn -----OTR/L, MOT, Tx
     
reader50
Administrator
Join Date: Jun 2000
Location: California
Status: Offline
Reply With Quote
Aug 18, 2023, 12:02 PM
 
Originally Posted by ghporter View Post
... yeah, I could buy a big old NAS and have Plex serve everything up ...
If you got the NAS, you could also set it up as a Time Machine destination. So your backups, and drive noise, and fan noise are in another room. That combination is what got me to go the NAS route.
     
ghporter  (op)
Administrator
Join Date: Apr 2001
Location: San Antonio TX USA
Status: Offline
Reply With Quote
Aug 18, 2023, 02:24 PM
 
I’d thought about a NAS setup, even without a media server, but I decided to just go with the least expensive option available. Right now, all I need to do is create the pages and put the media where Apache can see it. Plus, it’s kind of what having a Linux machine to play with is all about.

And since I got this machine specifically to set up an AirPrint server, any other use I can put it to is a bonus.

Glenn -----OTR/L, MOT, Tx
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 08:07 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,