You can configure a server that comes with your local APACHE,MAC computer when you need to make a request at home to tap the code. This is better than the local server on Windows, write down the fastest configuration scenario below.
0. Before you start, you need to set the password for your computer, it is necessary to open the local server.
One. Local Apache Server1. First build a Sites folder under the folder of your computer nickname
If you do not see this article in the Blog Park, please click to view the original
Put some fake data in the background. For example, mine is under the/USERS/DSX directory.
2. Locate the configuration file to back up the original file
The next step is to operate under the terminal and enter the following instruction (the code behind it can be copied directly )
Switch working directory
$cd/etc/apache2
Backup files, safekeeping, just need to be executed once.
$sudo cp httpd.conf Httpd.conf.bak
Hint: The following line of code do not hit, if the subsequent operation error! To restore the backed-up httpd.conf file using the following command (Dong Platinum Blog Park)
$sudo cp httpd.conf.bak httpd.conf
3. Start modifying the configuration file
Edit httpd.conf with Vim
$sudo vim httpd.conf
Find DocumentRoot
/documentroot
Press i to enter edit mode
You can see that there are two paths to change them to the path of the Sites folder you just built.
Then find the next PHP
/php
Navigate to this line and move the cursor to the left. Press x to delete "#" to open the directory
( If there is a 10.10 system, there is a step: find the options input /options can also visually find the location in the diagram, add a word between Options and follow)
After the change, press the ESC key to exit edit mode, and then enter : Wq Save and exit if you don't want to save the wrong way : q!
4. Finishing work and confirming success
Copy configuration file
$sudo cp php.ini.default php.ini
After restarting the Apache server, it's normal to say that.
$sudo apachectl-k restart
After that, it's normal to say that, don't worry.
Confirm the success of the end of the No, go to the browser to enter localhost if you can come to the following interface is right
5. Precautions
Note the previous backup. Do not back up multiple times.
Note that all English symbols and letters are used in the Vim editor.
The command for the server switch is
$sudo apachectl-k start
$sudo apachectl-k stop
Every time you turn off the computer and then want to use the server will be re-tapping the open command
Two. WebDAV Server
Next is the WebDAV server, which is based on Apache, that is, your Apache has started to open the WebDAV server.
Of course, if Apache is fully configured, then WebDAV will be well configured.
WebDAV can be used entirely as a network share file server!
1. Continue to modify
$ cd/etc/apache2
$ sudo vim httpd.conf
Find httpd-dav.conf
/httpd-dav.conf
Or the same as just now. Press i to edit, after positioning to this line, the cursor moves to the leftmost press x to delete the # number,
( If your computer is a 10.10 system, you also need to have the following underlined actions:)
Find these lines by searching
LoadModule Dav_module libexec/apache2/mod_dav.so
LoadModule Dav_fs_module libexec/apache2/mod_dav_fs.so
LoadModule Auth_digest_module libexec/apache2/mod_auth_digest.so
And the number of their line to remove the # (the friendship hint, they are all very similar to the president must see, do not change the wrong)
Press ESC to finish editing, enter: Wq exit
Then switch directories
$ Cd/etc/apache2/extra
Back up your files (remember to just back it up once.)
$ sudo cp httpd-dav.conf Httpd-dav.conf.bak
Now we're going to edit this file.
$ sudo vim httpd-dav.conf
Find Digest to change the editing mode from digest to Basic or to a few steps, and then save the exit after the change is done
/digest
2. Run the script file
The next step is to use a script file in this
Baidu Network disk: Http://pan.baidu.com/s/1jG7ogdS password is: yj9t
To switch directories, you can use the mouse to drag the folder where the put script is located directly behind the CD
$ CD to save the directory of put scripts
Run the put configuration script with administrator privileges
$ sudo./put
Will let you enter your computer password, and then to the admin account set password such as 123456
After the setup is complete, he will display a large string and then reboot the Apache server.
3. Verify that it is successful
Go to your network and look at the IP address you're connected to now.
(Dong-Platinum Blog Park)
Then click the Finder----Connect to the server--enter http://192.168.1.106/uploads (This is an example, you need to enter your own IP address)
Then a box will pop up, select the registered user, Account admin, password, such as 123456 can be connected
After the configuration is complete, you can write the URL of the file within your server by sending the requested URL in your code. It is also possible to perform download and upload operations without an external network connection.
Apache Apache server and WebDAV server fast configuration.