WebSharingOrientation
From Clothbot
(Difference between revisions)
Revision as of 03:57, 4 January 2008 (edit) AndrewPlumb (Talk | contribs) ← Previous diff |
Revision as of 04:17, 4 January 2008 (edit) AndrewPlumb (Talk | contribs) (→Aliasing Directories) Next diff → |
||
Line 42: | Line 42: | ||
# Restart '''Web Sharing''' so Apache re-reads the new configuration information. | # Restart '''Web Sharing''' so Apache re-reads the new configuration information. | ||
- | ==Enabling User CGI Support | + | ==Enabling User CGI Support== |
+ | |||
+ | You want ''http://localhost/~janbuck/cgi-bin/musicpad.cgi'' to do more than just serve up the text of a Perl script. | ||
+ | |||
+ | # Determine the full path to the directory you want to have Executable content | ||
+ | #* Terminal: '''cd ~/Sites/cgi-bin/''' | ||
+ | #* Terminal: '''pwd''' | ||
+ | #** Result: ''/Users/janebuck/Sites/cgi-bin'' | ||
+ | # Uncomment: ''#AddHandler cgi-script .cgi'' | ||
+ | # Configure the user cgi-bin to be Executable, add this block of text: | ||
+ | <Directory /Users/janebuck/Sites/cgi-bin> | ||
+ | Options Indexes FollowSymlinks MultiViews '''ExecCGI''' | ||
+ | AllowOverride None | ||
+ | Order allow,deny | ||
+ | Allow from all | ||
+ | </Directory> | ||
==Enabling PHP Support== | ==Enabling PHP Support== |
Revision as of 04:17, 4 January 2008
Contents |
Web Sharing Orientation
Starting and Stopping Web Sharing
- In your System Preferences, go into Sharing and turn on Web Sharing
- You should now be able to see an Apache web server running at http://localhost/
Troubleshooting
- Problem with permissions with Leopard-upgraded account.
- Terminal: sudo cp /etc/httpd/users/*.conf /etc/apache2/users/.
Serving Up Documents
- System Root
- Browser: http://localhost/
- Terminal: cd /Library/WebServer/Documents
- User-Specific
- Browser: http://localhost/~firstlast/
- Terminal: cd ~/Sites
Aliasing Directories
You want http://localhost/~janebuck/MacOSXHacks/ to show up as http://localhost/MacOSXHacks/. Aliasing is the way to do this.
- Determine the full path to the directory you want to alias
- Terminal: cd ~/Sites/MacOSXHacks/
- Terminal: pwd
- Result: /Users/janebuck/Sites/MacOSXHacks
- Add Alias: Alias /MacOSXHacks /Users/janebuck/Sites/MacOSXHacks
- Terminal: sudo vi /etc/apache2/httpd.conf
- vi (find the IfModule alias_module string): /IfModule alias_module
- Line: <IfModule alias_module>
- vi (insert after current line): o
- vi (type in alias text: Alias /MacOSXHacks /Users/janebuck/Sites/MacOSXHacks
- vi (exit edit mode with Esc key): <Esc>
- vi (colon character, write and quit): :wq
- vi (find the IfModule alias_module string): /IfModule alias_module
- GUI Editor Alternative: sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/apache2/httpd.conf
- Locate: <IfModule alias_module>
- Add Alias: Alias /MacOSXHacks /Users/janebuck/Sites/MacOSXHacks
- Save and exit. Make sure it does not Line-Wrap.
- Terminal: sudo vi /etc/apache2/httpd.conf
- Restart Web Sharing so Apache re-reads the new configuration information.
Enabling User CGI Support
You want http://localhost/~janbuck/cgi-bin/musicpad.cgi to do more than just serve up the text of a Perl script.
- Determine the full path to the directory you want to have Executable content
- Terminal: cd ~/Sites/cgi-bin/
- Terminal: pwd
- Result: /Users/janebuck/Sites/cgi-bin
- Uncomment: #AddHandler cgi-script .cgi
- Configure the user cgi-bin to be Executable, add this block of text:
<Directory /Users/janebuck/Sites/cgi-bin> Options Indexes FollowSymlinks MultiViews ExecCGI AllowOverride None Order allow,deny Allow from all </Directory>
Enabling PHP Support
- Terminal: sudo vi /etc/apache2/httpd.conf
- Uncomment: LoadModule php5_module libexec/apache2/libphp5.so
- vi (find the php5 string): /php5
- vi (move to the start of the line): ^
- vi (erase the # character): x
- vi (colon character, write and quit): :wq
- Uncomment: LoadModule php5_module libexec/apache2/libphp5.so
- GUI Editor Alternative: sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/apache2/httpd.conf
- Erase the # in front of the LoadModule php5_module libexec/apache2/libphp5.so line.
- Save and exit. Make sure it does not Line-Wrap.
- Reboot so apache starts up fresh.
References
- System Preferences Help (?)