centos7 安装 lnmp

ssh root@123.207.79.43  
错误信息  
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @  
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!  
Someone could be eavesdropping on you right now (man-in-the-middle attack)!  
It is also possible that a host key has just been changed.  
The fingerprint for the ECDSA key sent by the remote host is  
SHA256:Hl/dKTFzL4lOlF8DIG5itaV4OAsZunC2AWlFGLjLfsg.  
Please contact your system administrator.  
Add correct host key in /c/Users/\347\224\250\346\210\267/.ssh/known_hosts to get rid of this message.  
Offending ECDSA key in /c/Users/\347\224\250\346\210\267/.ssh/known_hosts:1  
ECDSA host key for 123.207.79.43 has changed and you have requested strict checking.  
Host key verification failed.  


清除认证  

$  rm -rf.ssh/known_hosts 

首先更新系统软件   yum update

安装nginx  

yum install nginx

nginx 常用命令 

启动       #systemctl start nginx.service  
自动启动   #systemctl enable nginx.service  
平滑启动   nginx -s reload  
重启       nginx -s reload  
重启       systemctl reload nginx.service  
重启       service nginx restart  

MySQL  安装     qiuyang 个人多次使用正常

下载mysql的repo源 

$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
安装mysql-community-release-el7-5.noarch.rpm包
$ rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装这个包后,会获得两个mysql的yum repo源: 
/etc/yum.repos.d/mysql-community.repo和/etc/yum.repos.d/mysql-community-source.repo。

安装mysql

安装yum install mysql-server
设置开机自启动 chkconfig mysqld on
重启service mysqld restart 或 systemctl restart mysqld.service 或 service mysqld start


安装 PHP 

#yum install php-fpm php-mysql  
#systemctl start php-fpm # 启动php-fpm  
#systemctl enable php-fpm # 设置开机启动  
#mkdir /usr/www  
#chown -R apache:apache /usr/www  
安装依赖包  yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpcphp-mbstring php-bcmath php-mhash   


修改Nginx配置文件
打开/etc/nginx下的nginx.conf,其中server部分修改如下:
server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  ffflipped.cn;
    root         /usr/www;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
        index index.php;
        try_files $uri $uri/ /index.php?$args;
    }

    rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
                access_log off; log_not_found off; expires max;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

}

保存后重载

nginx #systemctl reload nginx
在/usr/WWW目录中创建index.php

测试:123.206.57.252 或者解析好的域名http://ffflipped.cn 可以看到 hello world !

安装防火墙

yum install iptables-services -y  
编辑ipatbles的规则  
vim /etc/sysconfig/iptables  
重启iptables服务  
service iptables restart

添加可以访问的端口

编辑 vim /etc/sysconfig/iptables

*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibite






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值