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_modulehtml
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=-ljemallocmysql
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 --permanentnginx
------------------------------------------------------------------
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; //無關緊要c++
}
}
-----------------------------------------------------------------百度跳轉
server {
listen 80;
server_name 88.88.218.1;web
#charset koi8-r;sql
#access_log logs/host.access.log main;vim
location / {
proxy_pass http://www.baidu.com;
root html;
index index.html index.htm;
}bash
-----------------------------------------------------------------
/usr/local/nginx/conf/proxy.conf服務器
echo `curl http://www.baidu.com` > /usr/local/nginx/html/index.html
#############################################################################################################################mysql5.7安裝curl
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'; //刪除用戶受權