CentOS6.3搭建lnmp环境
来源:互联网 发布:回答乐队 知乎 编辑:程序博客网 时间:2024/04/30 00:31
1.本文直接禁用掉了防火墙iptables和selinux:
/etc/init.d/iptables stop
chkconfig iptables off
vi /etc/selinux/config
SELINUX=enforcing 改成 SELINUX=disabled
补充:# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo //直接163下载相关的源
2.下载第三方源
wget http://www.atomicorp.com/installers/atomic
sh ./atomic
yum check-update
3.安装web服务器nginx
yum install nginx
chkconfig nginx on
4.安装数据库mysql
yum install mysql mysql-server
chkconfig mysqld on
5.安装php环境
yum install php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm
chkconfig php-fpm on
vi /etc/nginx/conf.d/default.conf
(a)."index index.html index.htm;" 改为 "index index.html index.htm index.php;"
(b).
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
改成
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
7.
vi /etc/php.ini #编辑
date.timezone = PRC #在946行 把前面的分号去掉,改为date.timezone = PRC
#在386行 列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
open_basedir = .:/tmp/ #在380行,设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php木马跨站,如果改了之后安装程序有问题,可注销此行,或者直接写上程序目录路径/var/www/html/www.osyunwei.com/:/tmp/
:wq! #保存退出
8.
vi /etc/php-fpm.d/www.conf #编辑
user = nginx #修改用户为nginx
group = nginx #修改组为nginx
9.
chown nginx:nginx /usr/share/nginx/html/ -R
chmod 755 /usr/share/nginx/html/ -R
10.reboot
11.
vi /usr/share/nginx/html/index.php
输入:
<?php
phpinfo();
?>
在Windows浏览器输入:http://192.168.1.101/index.php
就可以看到结果了。
/etc/init.d/iptables stop
chkconfig iptables off
vi /etc/selinux/config
SELINUX=enforcing 改成 SELINUX=disabled
补充:# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo //直接163下载相关的源
2.下载第三方源
wget http://www.atomicorp.com/installers/atomic
sh ./atomic
yum check-update
3.安装web服务器nginx
yum install nginx
chkconfig nginx on
4.安装数据库mysql
yum install mysql mysql-server
chkconfig mysqld on
5.安装php环境
yum install php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm
chkconfig php-fpm on
vi /etc/nginx/conf.d/default.conf
(a)."index index.html index.htm;" 改为 "index index.html index.htm index.php;"
(b).
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
改成
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
7.
vi /etc/php.ini #编辑
date.timezone = PRC #在946行 把前面的分号去掉,改为date.timezone = PRC
#在386行 列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
expose_php = Off #在432行 禁止显示php版本的信息
magic_quotes_gpc = On #在745行 打开magic_quotes_gpc来防止SQL注入open_basedir = .:/tmp/ #在380行,设置表示允许访问当前目录(即PHP脚本文件所在之目录)和/tmp/目录,可以防止php木马跨站,如果改了之后安装程序有问题,可注销此行,或者直接写上程序目录路径/var/www/html/www.osyunwei.com/:/tmp/
:wq! #保存退出
8.
vi /etc/php-fpm.d/www.conf #编辑
user = nginx #修改用户为nginx
group = nginx #修改组为nginx
9.
chown nginx:nginx /usr/share/nginx/html/ -R
chmod 755 /usr/share/nginx/html/ -R
10.reboot
11.
vi /usr/share/nginx/html/index.php
输入:
<?php
phpinfo();
?>
在Windows浏览器输入:http://192.168.1.101/index.php
就可以看到结果了。
- CentOS6.3搭建lnmp环境
- CentOS6.3搭建lnmp环境
- yum搭建lnmp环境(CentOS6.3)
- yum搭建lnmp环境(CentOS6)
- yum搭建lnmp环境(CentOS6)
- yum搭建lnmp环境(CentOS6)
- CentOS6.5 LNMP环境搭建
- CentOS6.6搭建LNMP环境
- CentOS6.6搭建LNMP环境
- CentOS6.5搭建LNMP环境
- CentOS6.7搭建LNMP环境
- CentOS6.8搭建LNMP环境
- yum搭建lnmp环境(CentOS6.4)
- yum搭建lnmp环境(CentOS6.4)
- yum搭建lnmp环境(CentOS6.5)
- Centos6.5下源码搭建lnmp环境
- centos6.5下搭建lnmp环境
- 基于CentOS6.6搭建LNMP服务器环境
- XSL样式
- 12月新作
- android4.2源码编译全过程
- C++中的time
- ubuntu9.10 samba服务器设置参考1
- CentOS6.3搭建lnmp环境
- iBATIS中“#”和“$”的区别
- 吟游深渊录 节选
- 结合源码分析HBase相关操作流程
- MSDN看到的一个读写文件及路径等操作的例子,觉得可以学习一下。。。
- poj 1504
- Ubuntu 网卡ip地址设置参考
- 电阻
- Ubuntu12.04完美安装QQ2012教程(收集组织)