Configure the Apache server on OSXYomesite

Source: Internet
Author: User

Configure the Apache server on OSXYomesite

Mac OSX comes with an apache server. However, it is disabled by default in the Yomesite system. This causes various troubles when configuring the php environment.
I found this article and shared it with the same mac users.
Note: Only the apache configuration section of the original text is intercepted here. The original text contains perl content.
Link: https://discussions.apple.com/docs/DOC-3083
----------------------
The following is an article about how to create a local web server on OS X. This means a development platform for building and testing your website. This article describes how to configure Apache and PHP
Note1: Yosemite introduces some important improvements. Pay attention to your operating system version.
Note2: This article only applies to OSX clients, not Server versions.

Requirements:
Use terminal. app and instruct you how to run the command line program
What is web Server
Will use the vi command, you can also select nano

In the code block, you need to enter
Use your machine name instead. To be honest, I suggest you use a word for machine name, which will make the process simple (the author's machine name is apple, Translator's note)
Use your username instead.
OK, let's go

OSX lion and the updated version do not create a local server by default. If you have already created a website directory in snow leoard, the system will be in the original place after the upgrade.

Php is disabled by default in the latest version of the system. To enable the service, you must:

sudo vi /etc/apache2/httpd.conf

Uncomment the following line:

# Change LoadModule php5_module libexec/apache2/libphp5.so to LoadModule php5_module libexec/apache2/libphp5.so

If you are not familiar with the vi Editor, move the cursor to '#' and press 'X' to delete it. Enter ': W! 'To save changes
Location of the row:

10.7 Lion - line 11110.8 Mountain Lion - line 11710.9 Mavericks - line 11810.10 Yosemite - line 169

The Yosemite system also needs to cancel the comments of line 4:

# Change LoadModule userdir_module libexec/apache2/mod_userdir.so to LoadModule userdir_module libexec/apache2/mod_userdir.so

Same row 493rd:

# Include/private/etc/apache2/extra/httpd-userdir.conf TO Include/private/etc/apache2/extra/httpd-userdir.conf

Save and exit.

Again, for the Yosemite system, modify the file:

sudo vi /etc/apache2/extra/httpd-userdir.conf

Cancel the comments of 16 rows:

# Change Include/private/etc/apache2/users/*. conf TO Include/private/etc/apache2/users/*. conf.

Save and exit

When you enter the/etc/apache2 folder, make sure that you have a user configuration file named:

/etc/apache2/users/  .conf. 

This file is not automatically created in the lion and mountain lion systems (nor in Yosemite)
If the file does not exist, create it and run the following command:

sudo vi /etc/apache2/users/  .conf 

(If you are not used to creating a file using vi, you can use a text editor to create a file and put it in this folder. In this process, you may need to enter the management password)

For all systems other than Yosemite, use the following content:

  /Sites/"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from localhost 

For Yosemite systems:

  /Sites/"> AddLanguage en .en LanguagePriority en fr de ForceLanguagePriority Fallback Options Indexes MultiViews AllowOverride None Order allow,deny Allow from localhost Require all granted 

Run the vi command, Press esc, and then press zz to save and exit.

Then you can start apache.
Enter:

sudo apachectl start

Open safari and enter localhost in the address bar to view the it works output.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.