设为首页 收藏本站
查看: 1278|回复: 0

阿里云centos6(32bit)yum安装lnmp环境

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-1-27 08:55:34 | 显示全部楼层 |阅读模式
挂载数据盘
https://help.aliyun.com/knowledge_detail/5974154.html
fdisk -l
执行“fdisk  /dev/xvdb”命令,对数据盘进行分区;

根据提示,依次输入“n”,“p”“1”,两次回车,“wq”,分区就开始了,很快就会完成。

查看新的分区
使用“fdisk -l”命令可以看到,新的分区xvdb1已经建立完成了。

格式化新分区
以ext3为例:使用“mkfs.ext3  /dev/xvdb1”命令对新分区进行格式化,格式化的时间根据硬盘大小有所不同。

添加分区信息
使用“echo '/dev/xvdb1  /mnt ext3    defaults    0  0' >> /etc/fstab”(不含引号)命令写入新分区信息。
然后使用“cat /etc/fstab”命令查看,出现以下信息就表示写入成功。

挂载新分区
使用“mount -a”命令挂载新分区,然后用“df -h”命令查看,出现以下信息就说明挂载成功,可以开始使用新的分区了。


----------------------------------------------
uname -r  //查看linux内核版本
2.6.32-431.23.3.el6.i686


uname -a


//
top//类似win下资源管理器

按top后可以按q或者ctrl+c退出


//lnmp
//http://mp.weixin.qq.com/s?__biz=MzA4OTU1Mjg0NQ==&mid=401175398&idx=4&sn=dcbeca7c38ba3f816b42f5a002db87a6&3rd=MzA3MDU4NTYzMw==&scene=6#rd

yum install -y nginx      #安装nginx,根据提示,输入Y安装即可成功安装
service nginx start    #启动
chkconfig nginx on    #设为开机启动
/etc/init.d/nginx  restart  #重启


yum install -y mysql mysql-server

/etc/init.d/mysqld start

chkconfig mysqld on


yum install -y php

yum install -y 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  #设置开机启动
/etc/init.d/php-fpm start  #启动php-fpm
/etc/init.d/mysqld restart #重启MySql
/etc/init.d/nginx  restart  #重启Nginx
/etc/init.d/php-fpm restart  #重启动php-fpm


vi /etc/nginx/nginx.conf  #编辑
user  nginx  nginx;  #修改nginx运行账号为:nginx组的nginx用户
:wq!    #保存退出


vi /etc/nginx/conf.d/default.conf   #编辑
index index.php index.html index.htm;   #增加index.php
# pass the PHPscripts 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  $document_root$fastcgi_script_name;
   include       fastcgi_params;
}#取消FastCGI server下location的注释,并要注意fastcgi_param行的参数,/scripts改为$document_root 或者使用绝对路径
/etc/init.d/nginx  restart  #重启Nginx



vi /etc/php.ini #编辑
date.timezone = PRC #在946行 把前面的分号去掉,改为date.timezone = PRC
expose_php = Off #在432行 禁止显示php版本的信息


cp /etc/php-fpm.d/www.conf   /etc/php-fpm.d/www.confbak   #备份原有配置文件
vi /etc/php-fpm.d/www.conf   #编辑
user = nginx   #修改用户为nginxgroup = nginx   #修改组为nginx
/etc/init.d/mysqld restart  #重启MySql
/etc/init.d/nginx  restart  #重启nginx
/etc/rc.d/init.d/php-fpm  restart  #重启php-fpm


登陆MySQL删除空用户,修改root密码
mysql>select user,host,password from mysql.user;

mysql>drop user ''@localhost;

mysql>update mysql.user set password = PASSWORD('*********') where user='root';

mysql>flush privileges;


设置远程登录
grant all privileges on *.* to 'root'@'%' identified by 'xxxx' with grant option;
flush privileges;
quit;


chown nginx.nginx /usr/share/nginx/html/ -R  #设置目录所有者
chmod 777  /usr/share/nginx/html/ -R   #设置目录权限


/mnt/nginxwww


1. 创建自己的404.html页面

2.更改nginx.conf在http定义区域加入: fastcgi_intercept_errors on;

//3可以直接加在http定义区域 同样可以设置403页面

3.更改nginx.conf(或单独网站配置文件,例如在nginx -> sites-enabled下的站点配置文件 )

中在server 区域加入: error_page 404 = /404.html 或者 error_page 404 = http://www.xxx.com/404.html



禁止通过ip访问
server {
listen 80 default_server;
server_name _;
#return 444;
rewrite ^ http://forbidden.20140531.cn
}


//虚拟主机
server {
    listen       80;
    server_name  dedecms.XXXXX.cn;

    location / {
        root   /mnt/nginxwww/dedecms;
        index  index.php index.html index.htm;
    }

    location ~ \.php$ {
        #root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}
===================================================================================


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-170005-1-1.html 上篇帖子: LAMP架构之httpd+(php-fpm)+mariadb 下篇帖子: 【Linux】以分层架构方式搭建LAMP 阿里云
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表