我们只需要填写3个地方:1. host name 2.user name 3.password。hostname是虚拟机的IP地址。 最好是填写root用户时的用户名和密码。点击登陆就进入到Linux系统了 界面中,左边属于windows操作系统的目录,右边属于Linux(CentOS)操作系统的目录。可以用鼠标直接把文件拖过来拖过去的。
[root@localhost /]# cd /etc/nginx #定位到nginx安装目录 [root@localhost nginx]# vim nginx.conf #通过vim打开nginx.conf配置文件进行配置
在http节点中,添加配置
1 2 3 4 5 6 7
#设定负载均衡的服务器列表 upstream load_balance_server { #weigth参数表示权值,权值越高被分配到的几率越大 server 192.168.1.131:5100 weight=5; server 192.168.1.132:5100 weight=1; server 192.168.1.130:5100 weight=6; }
[root@localhost nginx]# service nginx restart Redirecting to /bin/systemctl restart nginx.service Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe"for details. [root@localhost nginx]# systemctl status nginx -l ● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Thu 2017-05-18 09:34:41 CST; 6s ago Process: 121270 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE) Process: 121265 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) Main PID: 117382 (code=exited, status=0/SUCCESS)
May 18 09:34:41 localhost.localdomain systemd[1]: Starting The nginx HTTP and reverse proxy server... May 18 09:34:41 localhost.localdomain nginx[121270]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok May 18 09:34:41 localhost.localdomain nginx[121270]: nginx: [emerg] bind() to 0.0.0.0:5100 failed (13: Permission denied) May 18 09:34:41 localhost.localdomain nginx[121270]: nginx: configuration file /etc/nginx/nginx.conf test failed May 18 09:34:41 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1 May 18 09:34:41 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server. May 18 09:34:41 localhost.localdomain systemd[1]: Unit nginx.service entered failed state. May 18 09:34:41 localhost.localdomain systemd[1]: nginx.service failed.
[toor@localhost bin]$ netstat -tunpl | grep 6379 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN - [toor@localhost bin]$ sudo netstat -tunpl | grep 6379 [sudo] password for toor: toor is not in the sudoers file. This incident will be reported. [toor@localhost bin]$ su root Password: [root@localhost bin]# netstat -tunpl | grep 6379 tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 101598/./redis-serv
[root@localhost bin]# pkill redis-server [root@localhost bin]# netstat -tunpl | grep 6379 [root@localhost bin]# pstree -p | grep redis [root@localhost bin]# redis-cli Could not connect to Redis at 127.0.0.1:6379: Connection refused Could not connect to Redis at 127.0.0.1:6379: Connection refused not connected>
Host ‘xx.xx.xx.xx’ is not allowed to connect to this MySQL server
注:需要在服务器登录mysql终端
改表法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
Database changed mysql> update user set host = '%' where user = 'root';//需要远程连接的用户 mysql> select host,user from user; +-----------+-----------+ | host | user | +-----------+-----------+ | % | root | | localhost | mysql | | localhost | mysql.sys | +-----------+-----------+ 3 rows in set (0.00 sec)
授权法
1 2 3 4 5
mysql> GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; //mysql 密码强度有验证;mypassword:密码 Query OK, 0 rows affected, 1 warning (0.00 sec)