设为首页 加入收藏

TOP

linux+Nginx+Mysql+Php(二)
2017-10-12 17:58:14 】 浏览:10038
Tags:linux Nginx Mysql Php
主机,再上网页查看

 

添加状态的server标签:

[root@localhost conf]# vim /application/nginx/conf/nginx.conf

 

 

##status

server {

        listen       80;

        server_name  status.cairui.org;

           location / {

                 stub_status on;

                 access_log  off;

}

}

win本地hosts文件中也要添加,

 

 

 

 

解决恶意域名绑定:

[root@localhost conf]# vim /application/nginx/conf/nginx.conf(必须放在第一个server

server {

        listen       80;

           location / {

           deny all;

 

}

            

}

 

开启日志功能:

[root@localhost conf]# cat /application/nginx/conf/nginx.conf.default (找到日志格式)

 

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

    #                  '$status $body_bytes_sent "$http_referer" '

    #                  '"$http_user_agent" "$http_x_forwarded_for"';

 

    #access_log  logs/access.log  main;

拷贝到nginx.conf下,去掉注释

 

 

 

 

错误日志格式放在最顶端

分析nginx日志的软件:syslogrsyslogAwstatsscribekafka

 

Mysql

mysql安装方法:

5.1---编译安装configuremakemake install

5.5---编译安装cmakemakemake install(可以直接用二进制包安装,解压即可)

 

1.安装mysql

[root@localhost conf]# useradd mysql -s /sbin/nologin -M

[root@localhost tools]# tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz

[root@localhost tools]# mv mysql-5.5.32-linux2.6-x86_64 /application/mysql5.5.32

[root@localhost tools]# ln -s /application/mysql5.5.32/ /application/mysql

[root@localhost tools]# chown -R mysql.mysql /application/mysql/data/

[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/application/mysql/ --datadir=/application/mysql/data/(编译之前需要安装libaio

[root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysqld

[root@localhost mysql]# vim /etc/init.d/mysqld

 

 

[root@localhost mysql]# cp support-files/my-small.cnf /etc/my.cnf (每个版本的配置文件不同)

cp:是否覆盖"/etc/my.cnf"y

[root@localhost mysql]# vim /etc/profile

 

 

[root@localhost mysql]# service mysqld start

Starting MySQL.. SUCCESS!

[root@localhost mysql]# mysql

数据库优化:

mysql> show databases

mysql> drop Database test;

mysql> select user,host from mysql.user;

mysql> drop user''@localhost;

[root@localhost mysql]# mysql -uroot -pnew

首页 上一页 1 2 3 4 下一页 尾页 2/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇CentOS 7 for ARM 安装一键Lnmp失.. 下一篇Cent OS 安装配置 步骤

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目