首页 > 代码库 > Apache, MySQL, phpMyAdmin在Mac OS X 10.9 下的配置
Apache, MySQL, phpMyAdmin在Mac OS X 10.9 下的配置
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Command: mysql_secure_installation +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we‘ll need the current
password for the root user. If you‘ve just installed MySQL, and
you haven‘t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
You already have a root password set, so you can safely answer ‘n‘.
Change the root password? [Y/n] n
... skipping.
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from ‘localhost‘. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named ‘test‘ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
All done! If you‘ve completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up...
NOTES:
********************************************************************************
Apache
OS X comes with Apache already installed, so it’s as simple as starting up the server. ?Previously, you could start this using the System Preferences > Sharing panel, but it has been removed from there in 10.9. To start the server, first start up Terminal app via Utilities > Terminal, and then enter the command below. You can read the full documentation on the apachectl command.
Start Apache:
1
$ sudo apachectl start
Stop Apache:
1
$ sudo apachectl stop
Restart Apache:
1
$
Another useful command is to verify your httpd.conf configuration via the -t test switch.
1
$ sudo apachectl -t
1 to check verison(apache 2.2.* UNIX comes with OS X 10.9)
apachectl -v
Then, open the link http://localhost we can see a default test page says "It works!".
********
IMPORTANT
********
The default system path where the localhost points to is (on OS X 10.9) :
/Library/WebServer/Documents
Then we can put our newly created site root directory in that place.
2. the apache server installation location is :
/etc/apache2/sudo apachectl restart
You can find all the configuration files about the server there.
configuration file: httpd.conf
3. Add php support to apache server so that it can handle with the files ended up
with .php or .phps
And configure the default responding pages for directory requests to the server.
(by default, apache is not configured to serve php files, so we need to change it!)
Follow the steps:
PHP
************************************* begin ************************************
PHP is already installed for you in OS X 10.9 Mavericks. ?It’s as simple as modifying the httpd.conf file again.
On line 118, uncomment the LoadModule for PHP:
LoadModule php5_module libexec/apache2/libphp5.so
On line 231, add index.php as a default document if a directory is requested:
DirectoryIndex index.html index.php
Lastly, we need to tell Apache to use the PHP handler when requesting files that end in .php or .phps. ?Append the following code to the end of your httpd.conf file.
#PHP Settings
<IfModule php5_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>
Don’t forget to restart the Apache server after making any changes to your httpd.conf file.
************************************* end ************************************
4. if we want to change the root directory of our web contents files(ie. Document Root in apache server configuration)
************************************ begin ************************************
Make the following changes to the httdp.conf file.
On line 170, change the DocumentRoot:
DocumentRoot “/www”
On line 197, change the Directory location:
<Directory “/www”>
On line 217 (within the Directory location we just updated), change the AllowOverride to “All” so that we can use .htaccess to modify any settings for our local sites:
AllowOverride All
On line 429, uncomment the Include of the httpd-vhosts.conf file:
Include /private/etc/apache2/extra/httpd-vhosts.conf
************************************* end ************************************
phpAdmin
http://coolestguidesontheplanet.com/installing-phpmyadmin-on-mac-osx-10-7-lion/
+************* IMPORTANT **************
when
# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf
in the httpd.conf is uncommented, then localhost will be redirected to /.
Example:
http://localhost/phpMyAdmin is compiled as virtualHost/phpMyAdmin. if your virtual
host is not configured correctly, then it will lead to a NOT Found error.
________________________________________________________________________________
MySQL
1. start the mysql server:
$ mysql.server start
几个参考的链接:
主要参考 http://brianflove.com/2013/10/23/os-x-mavericks-and-apache/
http://blog.csdn.net/ww122081351/article/details/18809197
Error message “Forbidden You don‘t have permission to access / on this server”
http://www.cyberciti.biz/faq/apache-403-forbidden-error-and-solution/
http://superuser.com/questions/270746/are-there-any-differences-between-etc-and-private-etc
高级功能: http://docs.phpmyadmin.net/en/latest/setup.html