Contos配置PHP-MySql-Apache-Nginx
Posted YamaDe
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Contos配置PHP-MySql-Apache-Nginx相关的知识,希望对你有一定的参考价值。
Apahce
./configure --prefix=/usr/local/apache --enable-module=most --enable-shared=max
make
su root
make install
运行Apahce
/usr/local/apache/bin/apachectl start
停止Apache
#/usr/local/apache/bin/apachectl stop
打开浏览器
firefox
重启防火墙
firewall-cmd --reload
干掉id进程
kill -9 进程id
>>> 关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
>>> 开启端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
----------------------
安装Apache
yum install httpd
--------------------------
kill -9 关闭的id
-----------------------
重启apahce
systemctl restart httpd.service
--------------------------
停止apache
systemctl stop httpd.service
---------------------
启动Apache
systemctl start httpd.service
查看php版本
php -v
安装php7.0.23版本
http://jingyan.baidu.com/article/7f41ecec2d3c04593d095c24.html
配置php7.0.23
http://blog.csdn.net/leedaning/article/details/45314109
----------------------------------------------------
contos上面安装mysql
参考网址:http://www.linuxidc.com/Linux/2016-09/135288.htm
# 下载mysql源安装包
shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
# 安装mysql源
shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm
检查mysql源是否安装成功
shell> yum repolist enabled | grep "mysql.*-community.*"
安装mysql:shell> yum install mysql-community-server
启动mysql:shell> systemctl start mysqld
4、开机启动
shell> systemctl enable mysqld
shell> systemctl daemon-reload
yum方式安装的mysql的删除方式
1、yum remove mysql mysql-server mysql-libs compat-mysql51
2、rm -rf /var/lib/mysql
3、rm /etc/my.cnf
mysql修改默认的密码设置长度
进入到mysql:set global validate_password_policy=0;
更改mysql的密码
mysql_secure_installation
----------------------------
启动mysql
systemctl start mysqld
--------------------------------------
打开mysql
mysql -uroot -p
关闭mysql密码策略
如果不需要密码策略,添加my.cnf文件中添加如下配置禁用即可:
validate_password = off
重新启动mysql服务使配置生效:
systemctl restart mysqld
开启防火墙
firewall-cmd --zone=public --add-port=3306/tcp --permanent
重启防火墙
firewall-cmd --reload
-----------------------------------------------------
ssh安装相关
查看ssh是否安装: rpm -qa | grep ssh
在线安装ssh: yum install openssh-server
启动ssh: ssh 192.168.87.131
------------------------------------------------------
mysql创建用户只能访问特定的数据库: grant all privileges on pg37.* to [email protected]‘192.168.87.1‘ identified by ‘123456‘;
创建一个pg37数据库并且是utf8字符集的: create database pg37 character set utf8 collate utf8_bin;
设置防火墙: firewall-cmd --zone=public --add-port=3306/tcp --permanent
重启防火墙: firewall-cmd --reload
ssh
启动ssh: ssh 192.168.87.131
查询已安装的程序服务: rpm -qa|grep mysql
------------------------------------------------
安装nginx:
(1)使用yum安装nginx需要包括Nginx的库,安装Nginx的库
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
(2)使用下面命令安装nginx
yum install nginx
(3)启动Nginx
service nginx start
或
systemctl start nginx.service
查询IP地址:
ifconfig -a
卸载mysql-php-apache
查询已安装的服务: rpm -qa | grep php
删除已安装的服务: yum remove 文件名
用rpm -qa | grep php 查看全部依赖包,再用命令 rpm -e 包名 将它们一一删除。 删除时会提示依赖关系,提示那个包就先那个包即可。
终极查漏的方式: httpd -v 还有 which httpd
删除带文件的文件夹:rm -rf /var/log/httpd
项目目录:var/www
以上是关于Contos配置PHP-MySql-Apache-Nginx的主要内容,如果未能解决你的问题,请参考以下文章
Contos配置PHP-MySql-Apache-Nginx