Instead of using the in-built Apache you can use a solution like MAMP to run the server independently of the OS.
- Create a suitable landing page:
mkdir ~/Sites
echo "<html>Hello World!</html>" > ~/Sites/index.html.en - Alter the Apache configuration to enable user sites:
- sudo cp /etc/apache2/httpd.conf /etc/apache2/httpd.conf.bak
- sudo vi /etc/apache2/httpd.conf
- Search for userdir: /userdir[Enter]
- Enter insert mode: i
- uncomment (remove the hash) on these lines:
#LoadModule userdir_module libexec/apache2/mod_userdir.so
#Include /private/etc/apache2/extra/httpd-userdir.conf - Save and Exit: Esc, :wq[Enter]
- Include the user configuration files:
cp /etc/apache2/extra/httpd-userdir.conf /etc/apache2/extra/httpd-userdir.conf.bak
sudo vi /etc/apache2/extra/httpd-userdir.conf
uncomment: Include /private/etc/apache2/users/*.conf - Create/edit a user configuration file:
- vi /etc/apache2/users/[short username].conf (maybe new file)
- Insert:
<Directory "/Users/[short username]/Sites/">
AddLanguage en .en
LanguagePriority en fr de
ForceLanguagePriority Fallback
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from localhost
Require all granted
</Directory> - Restart Apache:
sudo /usr/sbin/apachectl stop
sudo /usr/sbin/apachectl start - Start automatically on boot:
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
to stop it from starting automatically:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
No comments:
Post a Comment