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 > web site files and URLs in Mavericks

web site files and URLs in Mavericks
Thread Tools
Zoom
Mac Elite
Join Date: Feb 2000
Location: RTP, NC
Status: Offline
Reply With Quote
Oct 24, 2014, 04:46 PM
 
This may be the wrong forum, but not sure where else to put it.

I had a custom web site for an internal work tool I wrote. It's a series of CGI/perl files that processes some log files for easier viewing. I am currently hosting this under CentOS and standard apache. I'm used to that layout (/var/www). I'm trying to port it to OSX Server (Mavericks, soon to be Yosemite).

OSX totally messes with the directory layout of apache. I've found the Server app and set up my web site, but for the life of me, I can't understand how all the GUI fields line up with the old httpd.conf stuff. (In fact, I probably managed to edit that, too, which might be part of the issue). I created a new site using the GUI tool and I have it sort of working, but I still just can't figure out the right file layout and GUI config for my site.

I set the "domain name" to be my tool name, so that it would create the directory with that name. It created a directory under /Library/Web/Data/Sites/myTool/ and that's where I put the index.html file. I told the GUI tool to use the "myTool" directory as the location of the files. That works, but only if I set the "IP address" to the static IP of there server (not the default "Any"). Not sure why that is. But if I go to http://mytoolserver.mycompany.com, it loads my site fine. But if I use "Any" it loads the defauly site, not mine. Why is that? I don't get what that setting does.

I set up 3 aliases because I have three other directories that I want the web app to access - a dropbox directory, an output directory, and a data directory. I had to "chown" those dirs to be owned by "_www", which I guess is OSX's apache user ID. That works.

Then I had to put my CGI files in another dir:
/Library/Web/Data/CGI-Executables/myTool/

But I'm having trouble understanding how to create proper URL's in my HTML and CGI output. Using "/" by itself seems to reference the top level web site directory. "/cgi-bin/myTool/blah.cgi" also works for the script files. Some relative paths work, too, like "http://forums.macnn.com/images/mylogo.png". But I've had others that don't make sense at all. I watch the apache error log for details, but it doesn't always make sense - the path it creates vs the URL I used in the source.

Can anyone help me understand this? How do I know how to properly specify my files in "src" and "href" entries?

Also... should I delete the default OSX web sites? I think I tried this, and it did nothing.
Late 2012 27" iMac 3.4GHz Intel Core i7, 24GB RAM, 3TB Fusion drive
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Oct 24, 2014, 05:17 PM
 
I've never been a fan of using the OS X GUi. Why not copy over your old web files as is, including your web server configuration, and just run everything with no changes? You don't have to run your sites out of the directories Apple uses, they can be whatever you want.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Oct 24, 2014, 05:19 PM
 
If you want to do this, I would suggest installing your own version of Apache and dependencies via Homebrew or Macports, as you might find that Apple will reset your configurations or mess with your stuff with software updates. It would be better to have your own sandbox which is totally separate from all the Apple stuff.
     
Zoom  (op)
Mac Elite
Join Date: Feb 2000
Location: RTP, NC
Status: Offline
Reply With Quote
Oct 24, 2014, 06:47 PM
 
Yes, I could do my own thing... but I've found in the past that I prefer to do it Apple's way, when I can. And I would just like to understand it. There has to be some sense to it. You'd think there would be documentation, but I haven't found anything sufficiently detailed, just high-level stuff.
Late 2012 27" iMac 3.4GHz Intel Core i7, 24GB RAM, 3TB Fusion drive
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Oct 24, 2014, 09:36 PM
 
Originally Posted by Zoom View Post
Yes, I could do my own thing... but I've found in the past that I prefer to do it Apple's way, when I can. And I would just like to understand it. There has to be some sense to it. You'd think there would be documentation, but I haven't found anything sufficiently detailed, just high-level stuff.

Apple doesn't necessarily know best, especially not more so than Redhat, and even if they did, why mess around with working configurations that power a working app, and intentionally tether yourself to Apple's way of doing things?

There is a reason why Homebrew, Macports, Fink, etc. exist. Apple is not terribly good at maintaining the best possible environment for hosting web apps. For starters, it is generally opaque as to which security fixes they'll backport to their old bundled versions, when, what effect this will have on your apps, etc.

Doing things Apple's way is like being in the taxi where you don't know whether the driver is drunk or sober. I suggest being your own driver with web apps you depend on. Let Apple be the driver of your OS X apps, they are good at that.
     
Zoom  (op)
Mac Elite
Join Date: Feb 2000
Location: RTP, NC
Status: Offline
Reply With Quote
Oct 25, 2014, 12:06 PM
 
Well, here's why I like to try to stick with Apple's way. First, the UI tools can be nice, and frankly over the years I've come to get really tired of hand-editing arcane .conf files. Second, because Apple has re-arranged all the standard directories, I'm afraid to try to change them by slapping down my CentOS .conf file because of potential knock-on effects. Do Tomcat depend on these directories, too? What about Apple's other Server software and tools? Leaving the Apple Way can get ugly if you don't understand what the side effects might be, and getting back to the Apple Way can be difficult. Finally, I'm seriously doubting I can drop in an httpd.conf file from an old CentOS apache (1) setup into Apple's modern apache2 setup and expect it to work.

I hear what you're saying and I appreciate the help, but surely there are people that actually do get Apple's setup to work and if I can do that, I'd like to. I've already done 90% of the work to convert all the URLs and directory paths. I'm almost there. But I have to admit that I'm not understanding the directory layout and aliasing that might be built-in.
Late 2012 27" iMac 3.4GHz Intel Core i7, 24GB RAM, 3TB Fusion drive
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Oct 25, 2014, 12:15 PM
 
Originally Posted by Zoom View Post
Well, here's why I like to try to stick with Apple's way. First, the UI tools can be nice, and frankly over the years I've come to get really tired of hand-editing arcane .conf files. Second, because Apple has re-arranged all the standard directories, I'm afraid to try to change them by slapping down my CentOS .conf file because of potential knock-on effects. Do Tomcat depend on these directories, too? What about Apple's other Server software and tools? Leaving the Apple Way can get ugly if you don't understand what the side effects might be, and getting back to the Apple Way can be difficult. Finally, I'm seriously doubting I can drop in an httpd.conf file from an old CentOS apache (1) setup into Apple's modern apache2 setup and expect it to work.
Solutions like Macports create dedicated self-contained sandboxes such as /opt, where you don't have to worry about there being conflicts. There are no side effects whatsoever, you can switch between Apple's bits and these other bits so long as you're comfortable with starting/stopping daemons via launchd. If you really wanted to install Apache 1.x using Macports, you probably could. You could also ditch Apache and go with a more modern web server such as NGinx, which Apple does not include.

I honestly think you're making things far more difficult than they need to be.
     
Zoom  (op)
Mac Elite
Join Date: Feb 2000
Location: RTP, NC
Status: Offline
Reply With Quote
Oct 25, 2014, 12:18 PM
 
If they really sandbox everything, then that might work. I actually don't want apache1 - I want to update. I'm used to apache, and haven't had much trouble with it.

How difficult is it to install Macports and use it? I've never done it. I looked at Fink once a long time ago, and gave up on it.
Late 2012 27" iMac 3.4GHz Intel Core i7, 24GB RAM, 3TB Fusion drive
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Oct 25, 2014, 03:47 PM
 
Originally Posted by Zoom View Post
If they really sandbox everything, then that might work. I actually don't want apache1 - I want to update. I'm used to apache, and haven't had much trouble with it.

How difficult is it to install Macports and use it? I've never done it. I looked at Fink once a long time ago, and gave up on it.

It was easy for me. I'd check out Homebrew first, it is probably easier to get going, although it doesn't create a sandbox.

Homebrew — The missing package manager for OS X
     
Zoom  (op)
Mac Elite
Join Date: Feb 2000
Location: RTP, NC
Status: Offline
Reply With Quote
Oct 27, 2014, 01:46 PM
 
Homebrew looks good. But just to be clear here... are you suggesting that I reinstalled Apache2 with Homebrew? Wouldn't I need to do that to get the standard (non-Apple) apache directory structure? I don't see 'apache2' on the Homebrew list - because I think they don't install anything that's already there, right?

Sorry if I'm being dense. But how do I create this sandboxed version of apache2 using Homebrew?
Late 2012 27" iMac 3.4GHz Intel Core i7, 24GB RAM, 3TB Fusion drive
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Oct 27, 2014, 02:27 PM
 
Originally Posted by Zoom View Post
Homebrew looks good. But just to be clear here... are you suggesting that I reinstalled Apache2 with Homebrew? Wouldn't I need to do that to get the standard (non-Apple) apache directory structure? I don't see 'apache2' on the Homebrew list - because I think they don't install anything that's already there, right?

Sorry if I'm being dense. But how do I create this sandboxed version of apache2 using Homebrew?

Yeah, Homebrew is a supplement to Apple's stuff, Macports is a sandboxed replacement.
     
   
 
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 04:42 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.,