fedora 安装nginx+php+mysql
环境
fedora 最新版 20
参考:http://www.cnblogs.com/beceo/archive/2012/08/21/2648378.html
-----------------------------------------------------」
以下是ROOT权限执行
yum install mysql mysql-server
因开源yum上面是MariaDB,是目前最受关注的MySQL数据库衍生版。所以执行安装的是MariaDB
[xh@localhost ~]$ sudo systemctl enable mariadb.service ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service' [xh@localhost ~]$ sudo systemctl start mariadb.service [xh@localhost ~]$ sudo systemctl status mysqld mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled) Active: active (running) since Thu 2014-08-28 20:19:21 CST; 47min ago Main PID: 1086 (mysqld_safe) CGroup: /system.slice/mariadb.service ├─1086 /bin/sh /usr/bin/mysqld_safe --basedir=/usr └─1337 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql... Aug 28 20:19:11 localhost.localdomain systemd[1]: Starting MariaDB database s... Aug 28 20:19:17 localhost.localdomain mysqld_safe[1086]: 140828 20:19:17 mysq... Aug 28 20:19:17 localhost.localdomain mysqld_safe[1086]: 140828 20:19:17 mysq... Aug 28 20:19:21 localhost.localdomain systemd[1]: Started MariaDB database se... Aug 28 21:06:37 localhost.localdomain systemd[1]: Started MariaDB database se... Hint: Some lines were ellipsized, use -l to show in full.
//设置mysql的ROOT用户密码。 [xh@localhost ~]$ mysql_secure_installation[xh@localhost ~]$yum install nginx
[xh@localhost ~]$systemctl enable nginx.service [xh@localhost ~]$systemctl start nginx.service
[xh@localhost ~]$yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy
[xh@localhost /]$ vi /etc/php-fpm.d/www.conf
/*****
39 user = nginx
40 ; RPM: Keep a group allowed to write in log dir.
41 group = nginx
**/
systemctl start php-fpm.service
[xh@localhost nginx]$ vi /etc/nginx/nginx.conf
77 location ~ \.php$ { 78 root html; 79 fastcgi_pass 127.0.0.1:9000; 80 fastcgi_index index.php; 81 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_scrip t_name; 82 include fastcgi_params; 83 }
在/usr/share/nginx/html 下建个test.php文件
<?php phpinfo(); ?>
测试http://127.0.0.1/test.php