|
|
#1 |
|
MVP
Join Date: Jul 2002
Location: Texas
Posts: 1,075
|
Can I run SSI's locally on my Mac?
I was reading this thread which brought me to wonder about something. Can I run SSI's locally on my Mac without having the server version of OS X?
My website uses SSI's throughout each page. They work just fine from my actual website (not hosted by my Mac). But while working on my website on my Mac, I've grown accustomed that the SSI's won't work locally. I have to either manually insert the SSI codes into the file I'm working on and then replace it with the SSI include codes once I have everything working the way I want or I just ignore the SSI info until I've uploaded it to my webhost. Is there any way I can tell my Mac to actually run the SSI's from my hard drive while I'm developing my website locally? Also, if it makes any difference, I do not use the .shtml extension online. Instead, I have installed an .htaccess file that tells it to use .html. The .htaccess file I have on my hard drive is always renamed /htaccess when it's downloaded (pre OS X days). Should I/can I change this to .htaccess, and if I do, will this make the SSI's run locally on my Mac? Or do I have to have the server version of OS X to do any of this?
__________________
Vicki • 15" MacBook Pro 2.66GHz i7, Mavericks 10.9.1, 8GB RAM • iPad 4G WiFi 64GB • iPhone 5 64GB • 15" MacBook Pro 2.4GHz, Tiger 10.4, 4GB RAM • G5 Dual 2GHz, Panther 10.3, 1.5GB RAM • G4 Dual 1GHz, Tiger 10.4, 1.5GB RAM Using Macs since 1986! |
|
|
|
|
|
#2 |
|
Triple-A Player
Join Date: Jan 2002
Location: Sweden
Posts: 122
|
You can do this in the client version, you just need to edit the apache configuration file. Use pico or BBEdit or whatever to edit /etc/httpd/httpd.conf.
Uncomment the following lines: Code:
LoadModule includes_module libexec/httpd/mod_include.so Code:
AddModule mod_include.c Code:
AddType text/html .shtml AddHandler server-parsed .shtml You also have to add the Includes option to the document root (or the directory you place your SSI files). The relevant part of my configuration looks like this: Code:
<Directory "/Library/WebServer/Documents">
#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
Options FollowSymLinks MultiViews Includes ExecCGI
#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
Erik Last edited by eriklager; 08-05-2002 at 11:53 AM. |
|
|
|
|
|
#3 |
|
Triple-A Player
Join Date: Jan 2002
Location: Sweden
Posts: 122
|
You will have to access the files through to web server, of course. SSI will not work if you open the files directly from the Finder or with file:///whatever.html.
Access them with http://localhost/whatever.html. Erik |
|
|
|
|
|
#4 |
|
MVP
Join Date: Jul 2002
Location: Texas
Posts: 1,075
|
Okay, some very basic questions.
1) How can I make a backup of /etc/httpd/httpd.conf so I can start over if I screw the whole thing up? 2) I have BBEdit v6.5.2. Can I use it to make the changes? I am able to pull the file up (I'm looking at it right now). What options/formats/whatever do I use when saving it? Or will BBEdit "know" what to do if I just hit save?
__________________
Vicki • 15" MacBook Pro 2.66GHz i7, Mavericks 10.9.1, 8GB RAM • iPad 4G WiFi 64GB • iPhone 5 64GB • 15" MacBook Pro 2.4GHz, Tiger 10.4, 4GB RAM • G5 Dual 2GHz, Panther 10.3, 1.5GB RAM • G4 Dual 1GHz, Tiger 10.4, 1.5GB RAM Using Macs since 1986! |
|
|
|
|
|
#5 |
|
Triple-A Player
Join Date: Jan 2002
Location: Sweden
Posts: 122
|
To back it up, since you have alredy opened it in BBEdit, you can just choose Save As and put it where you want. You could also use the terminal to sudo cp /etc/httpd/httpd.conf /etc/httpd/httpd.conf.bak, it really doesn't matter which way you do it, it's just a text file.
I think there is also a backup of the original config file called httpd.conf.default in the same directory (/etc/httpd). BBEdit will do the right thing. You don't have to change format settings, at least I don't. Just hit Save when you are done and you will even get an authentication dialog. Erik |
|
|
|
|
|
#6 |
|
MVP
Join Date: Jul 2002
Location: Texas
Posts: 1,075
|
Okay, I'll get started on it then. I see there are a couple of files already in the dir that appear to be copies of the httpd.conf (default and prefix) so I probably already have backups I could use if needed.
I used BBEdit's Save As command to make a backup in a dir in my home, and I thought this difference was interesting. I have no idea what wheel or staff might possibly mean. Original File: -rw-r--r-- 1 root wheel 37441 Apr 15 23:42 httpd.conf BBEdit Save As file: -rw-r--r-- 1 vicki staff 37441 Aug 5 11:34 httpd.conf I'll be so glad when I have a clue what I'm doing. I feel like I'm running blind on all of this stuff.
__________________
Vicki • 15" MacBook Pro 2.66GHz i7, Mavericks 10.9.1, 8GB RAM • iPad 4G WiFi 64GB • iPhone 5 64GB • 15" MacBook Pro 2.4GHz, Tiger 10.4, 4GB RAM • G5 Dual 2GHz, Panther 10.3, 1.5GB RAM • G4 Dual 1GHz, Tiger 10.4, 1.5GB RAM Using Macs since 1986! |
|
|
|
|
|
#7 | |||||||||||||||||||
|
MVP
Join Date: Jul 2002
Location: Texas
Posts: 1,075
|
Hey! That's almost the same thing I have in my .htaccess file on my website. Can I edit that line to say: AddHandler server-parsed .html Notice the missing "s" in .html. Can I? Can I? And if so, could I then bypass the need for using the .htaccess file locally?
__________________
Vicki • 15" MacBook Pro 2.66GHz i7, Mavericks 10.9.1, 8GB RAM • iPad 4G WiFi 64GB • iPhone 5 64GB • 15" MacBook Pro 2.4GHz, Tiger 10.4, 4GB RAM • G5 Dual 2GHz, Panther 10.3, 1.5GB RAM • G4 Dual 1GHz, Tiger 10.4, 1.5GB RAM Using Macs since 1986! |
|||||||||||||||||||
|
|
|
|
|
#8 | ||||||||||||||||||||||||||||||||||||||
|
Triple-A Player
Join Date: Jan 2002
Location: Sweden
Posts: 122
|
They are both groups... admins are members of wheel and all users created in the Users preferences pane are members of staff. If you for some reason have to restore the previos file you can open both files (/etc/httpd/httpd.conf and the backup copy), copy all the text from the backup, paste it in httpd.conf and save... no file permissions will be changed. But that will probably never be required.
Yes, sure, at least trying can do no harm .Don't forget to restart apache when you have saved the file. Erik |
||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#9 |
|
MVP
Join Date: Jul 2002
Location: Texas
Posts: 1,075
|
Okay, damage is done (I really love BBEdit!
). So now for my next highly ignorant question.How do I restart apache? And while I'm asking ignorant questions... How do I access my files with http://localhost/whatever.html as directed earlier? My newbieness in all of this doesn't show, does it?
__________________
Vicki • 15" MacBook Pro 2.66GHz i7, Mavericks 10.9.1, 8GB RAM • iPad 4G WiFi 64GB • iPhone 5 64GB • 15" MacBook Pro 2.4GHz, Tiger 10.4, 4GB RAM • G5 Dual 2GHz, Panther 10.3, 1.5GB RAM • G4 Dual 1GHz, Tiger 10.4, 1.5GB RAM Using Macs since 1986! |
|
|
|
|
|
#10 | |||||||||||||||||||
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
group wheel is the root group GID=0 admin is OSX's admin group GID=80 afforded access to sudo (thru the sudoers file) and some special privileges at the Aqua level staff is the general OSX user group GID=20 admin users are not members of group wheel, but can be added. Code:
% nidump group . | egrep 'admin|staff|wheel' wheel:*:0:merv,nico staff:*:20:root,merv admin:*:80:root,merv,nico |
|||||||||||||||||||
|
|
|
|
|
#11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Triple-A Player
Join Date: Jan 2002
Location: Sweden
Posts: 122
|
Just stop and then start web sharing in the Sharing preference pane (in System Preferences).
Oh, i forgot to say that, the files have to be in either /Library/WebServer/Documents or in ~/Sites. To access /Library/WebServer/Documents/mypage.html type http://localhost/mypage.html in a web browser. To access /Users/username/Sites/anotherpage.html, go to http://localhost/~username/anotherpage.html.
Don't worry, that's what the forums are here for. Erik |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#12 | |||||||||||||||||||
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
Code:
% man apachectl
apachectl(1) apachectl(1)
NAME
apachectl - Apache HTTP server control interface
SYNOPSIS
apachectl command [...]
|
|||||||||||||||||||
|
|
|
|
|
#13 | |||||||||||||||||||
|
Triple-A Player
Join Date: Jan 2002
Location: Sweden
Posts: 122
|
That's right, but if you add admin rights to a user in the Users preference pane it gets added to wheel automatically. So admins will be members of wheel if you don't change it yourself in NetInfo. Right? Erik Last edited by eriklager; 08-05-2002 at 02:17 PM. |
|||||||||||||||||||
|
|
|
|
|
#14 |
|
MVP
Join Date: Jul 2002
Location: Texas
Posts: 1,075
|
I'm almost there!
![]() Tried: http://localhost/vickishome/index.html. Received: 403 Forbidden You don't have permission to access /vickishome/index.html on this server. Obviously, I need to change my permissions. Which ones? Where? To what? Oh, and while I'm at it... how?
__________________
Vicki • 15" MacBook Pro 2.66GHz i7, Mavericks 10.9.1, 8GB RAM • iPad 4G WiFi 64GB • iPhone 5 64GB • 15" MacBook Pro 2.4GHz, Tiger 10.4, 4GB RAM • G5 Dual 2GHz, Panther 10.3, 1.5GB RAM • G4 Dual 1GHz, Tiger 10.4, 1.5GB RAM Using Macs since 1986! |
|
|
|
|
|
#15 |
|
MVP
Join Date: Jul 2002
Location: Texas
Posts: 1,075
|
Merv, I think I have permission problems.
Code:
[12:42pm] [vicki] [/etc/httpd] You rang? % apachectl restart /usr/sbin/apachectl restart: httpd not running, trying to start Processing config directory: /private/etc/httpd/users Processing config file: /private/etc/httpd/users/vicki.conf [Mon Aug 5 13:20:05 2002] [alert] httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName fopen: Permission denied httpd: could not open error log file /private/var/log/httpd/error_log. /usr/sbin/apachectl restart: httpd could not be started Code:
[1:20pm] [vicki] [/etc/httpd] You rang? % apachectl start Processing config directory: /private/etc/httpd/users Processing config file: /private/etc/httpd/users/vicki.conf [Mon Aug 5 13:22:08 2002] [alert] httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName fopen: Permission denied httpd: could not open error log file /private/var/log/httpd/error_log. /usr/sbin/apachectl start: httpd could not be started
__________________
Vicki • 15" MacBook Pro 2.66GHz i7, Mavericks 10.9.1, 8GB RAM • iPad 4G WiFi 64GB • iPhone 5 64GB • 15" MacBook Pro 2.4GHz, Tiger 10.4, 4GB RAM • G5 Dual 2GHz, Panther 10.3, 1.5GB RAM • G4 Dual 1GHz, Tiger 10.4, 1.5GB RAM Using Macs since 1986! |
|
|
|
|
|
#16 | |||||||||||||||||||
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
erik, you are correct and this is new behavior (?) because under 10.1.2, i had to manually add my admins to group wheel. thanks for pointing it out and making me revisit the issue. as a side note, i don't like this behavior that admin automatically have wheel access. {sigh} vicki, use sudo for apachectl |
|||||||||||||||||||
|
|
|
|
|
#17 |
|
MVP
Join Date: Jul 2002
Location: Texas
Posts: 1,075
|
Sorry for so many questions, but... There are a bunch of files already in /Library/Webserver/Documents. Can I trash them? I want only my website files in there.
__________________
Vicki • 15" MacBook Pro 2.66GHz i7, Mavericks 10.9.1, 8GB RAM • iPad 4G WiFi 64GB • iPhone 5 64GB • 15" MacBook Pro 2.4GHz, Tiger 10.4, 4GB RAM • G5 Dual 2GHz, Panther 10.3, 1.5GB RAM • G4 Dual 1GHz, Tiger 10.4, 1.5GB RAM Using Macs since 1986! |
|
|
|
|
|
#18 | |||||||||||||||||||
|
Triple-A Player
Join Date: Jan 2002
Location: Sweden
Posts: 122
|
Both index.html and the folder it resides in (vickishome) must be readable by everyone or user/group www. So the easiest way is to select the folder containing the site in the Finder, press Command-I, go to the Privileges section, add read-only rights to everyone and apply to all enclosed folders (but be careful with "Apply to all enclosed folders" if you have files in your site that require special privileges). Erik Last edited by eriklager; 08-05-2002 at 02:38 PM. |
|||||||||||||||||||
|
|
|
|
|
#19 |
|
MVP
Join Date: Jul 2002
Location: Texas
Posts: 1,075
|
Apache restarted.
Still have permissions problems. ![]() Erik, we were posting at the same time. I'll give your suggestion a try. Wish me luck!
__________________
Vicki • 15" MacBook Pro 2.66GHz i7, Mavericks 10.9.1, 8GB RAM • iPad 4G WiFi 64GB • iPhone 5 64GB • 15" MacBook Pro 2.4GHz, Tiger 10.4, 4GB RAM • G5 Dual 2GHz, Panther 10.3, 1.5GB RAM • G4 Dual 1GHz, Tiger 10.4, 1.5GB RAM Using Macs since 1986! |
|
|
|
|
|
#20 | |||||||||||||||||||
|
Triple-A Player
Join Date: Jan 2002
Location: Sweden
Posts: 122
|
You can trash them if you want, it is just the apache welcome page. I have put them in a separate folder. Erik |
|||||||||||||||||||
|
|
|
![]() |
|
|