码迷,mamicode.com
首页 > 数据库 > 详细

nginx与mysql安装

时间:2019-02-16 18:21:59      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:addition   systemctl   config   tables   val   useradd   one   star   ant   

yum install -y wget vim gcc-c++ bash-completion
wget http://nginx.org/download/nginx-1.14.0.tar.gz
tar xf nginx-1.14.0.tar.gz -C /root
cd /root/nginx-1.14.0
useradd -s /sbin/nologin nginx
yum -y install gcc pcre-devel openssl-devel
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-stream --with-http_v2_module --with-http_gzip_static_module --with-http_gunzip_module --with-stream_ssl_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module

BT
--user=nginx --group=nginx --prefix=/www/server/nginx --with-openssl=/www/server/nginx/src/openssl --add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/nginx/src/lua_nginx_module --add-module=/www/server/nginx/src/ngx_cache_purge --add-module=/www/server/nginx/src/nginx-sticky-module --add-module=/www/server/nginx/src/nginx-http-concat --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-stream --with-stream_ssl_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-ld-opt=-ljemalloc

make && make install
pkill httpd
ln -s /usr/local/nginx/sbin/nginx /sbin/
nginx
nginx -s reload
firewall-cmd --zone=public --add-port=80/tcp --permanent

------------------------------------------------------------------
server {
listen 80; //端口
server_name www.b.com; //域名
charset utf-8; //支持所有编码utf-8 万国编码
location / {
root www; //指定网站根路径
index index.html index.htm;
}
}
-----------------------------------------------------------------反向代理
http {
.. ..
upstream webserver { //定义集群 //注意位置 upstream 定义服务器名字 webserver 集群服务器名字
server 192.168.2.100:80; //集群的第一台机
server 192.168.2.200:80; //集群的第二台机
}
.. ..
server {
listen 80; //监听80端口
server_name localhost; //定义域名
location / {
proxy_pass http://webserver; //跳转到webserver
root html; //可有可无
index index.html index.htm; //可有可无

}
}
-----------------------------------------------------------------百度跳转
server {
listen 80;
server_name 88.88.218.1;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
proxy_pass http://www.baidu.com;
root html;
index index.html index.htm;
}

-----------------------------------------------------------------
/usr/local/nginx/conf/proxy.conf

echo `curl http://www.baidu.com` > /usr/local/nginx/html/index.html
#############################################################################################################################mysql5.7安装

wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql-server
systemctl start mysqld
systemctl enable mysqld #设置开机自动启动
ps -C mysqld #检查是否有进程
netstat -utnlp | grep mysqld #看服务端口是否启动
grep password /var/log/mysqld.log #查询初始化密码C8&rp/gN#ijd
mysql -hlocalhost -uroot -p‘系统产生的随机密码‘
mysql>set global validate_password_policy=0; 只检查密码的长度
mysql>set global validate_password_length=6; 密码长度不能小于6个
mysql>alter user root@"localhost" identified by "weilai"; #用于改密码
mysql>alter user root@"localhost" identified by "Hdug&34dg1Gd";
]#vim /etc/my.cnf
[mysqld]#这个不放进去,以下如果不放,你用简短密码后期还是无法登陆,长密码无所谓
validate_password_policy=0
validate_password_length=6
lower_case_table_names=1 //忽略大小写
:wq
]#systemctl restart mysqld


//防火墙配置
[root@localhost ~]# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT //centOS6 版本的端口放行
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=3306/tcp
success

mysql> grant all on *.* to root@"%" identified by "Hdug&34dg1Gd";

select user,host,authentication_string from mysql.user; //查看授权列表
drop user ‘root‘@‘192.168.12.1‘; //删除用户授权

nginx与mysql安装

标签:addition   systemctl   config   tables   val   useradd   one   star   ant   

原文地址:https://www.cnblogs.com/weilaibuxiangshuo/p/10388608.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!