linux基本操作之w3m,iptables

如何实现linux访问网页

  1.  [root@cloud conf]# cat /etc/redhat-release
    CentOS release 6.4 (Final)
  2. [root@cloud conf]# yum -y install w3m
    Loaded plugins: fastestmirror, refresh-packagekit, security
    Loading mirror speeds from cached hostfile
    * base: mirrors.pubyun.com
    * extras: mirrors.skyshe.cn
    * updates: mirrors.pubyun.com
    Setting up Install Process
    Package w3m-0.5.2-19.el6.x86_64 already installed and latest version
    Nothing to do
  3. [root@cloud conf]# w3m www.baidu.com 如下图
w3m
w3m

 

打开centos下80端口的问题

/etc/sysconfig/iptables文件如果是这样的配置的话,那么搭建起来的网站是访问不到的。

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

必须要在防火墙配置里头添加

-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT 这段,打开80端口,不然会被防火墙拒绝服务。

完整的应该是这样的:

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

centos下查看mysql使用的何种类型的编码的方法

[root@iZ235nisr0lZ zcpingdata]# mysql -u xxx -pxxx
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3698107
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables like '%character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)