標籤:blog http io os 使用 ar for 檔案 資料
nodejs
http://zhaohe162.blog.163.com/blog/static/38216797201402234212981/
mem
http://blog.csdn.net/yybjroam05/article/details/8651789
memcached -d -p 11212 -u memcached -m 64 -c 1024 -P /var/run/memcached/memcached.pid
memcached -d -p 11213 -u memcached -m 64 -c 1024 -P /var/run/memcached/memcached.pid
nginx
http://www.cnblogs.com/zhoulf/archive/2013/02/09/2909653.html
mysql
http://www.2cto.com/database/201305/208114.html
修改密碼 重新整理許可權和重啟mysql
update user set password=password(‘自己的密碼‘) where user=‘root‘;
flush privileges;
service mysqld restart;
刪除匿名使用者
在MySQL剛剛被安裝後,存在使用者名稱、密碼為空白的使用者。這使得資料庫伺服器有無需密碼被登入的可能性。為消除隱患,將匿名使用者刪除。
[[email protected] ~]# mysql -u root -p ← 通過密碼用root登入
Enter password: ← 在這裡輸入密碼
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 4.1.20
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the buffer.
mysql> select user,host from mysql.user; ← 查看使用者資訊
+------+----------------------------+ www.2cto.com
| user | host |
+------+----------------------------+
| | localhost |
| root | localhost |
| | sample.centospub.com |
| root | sample.centospub.com |
+------+----------------------------+
4 rows in set (0.02 sec)
mysql> delete from mysql.user where user=‘‘; ← 刪除匿名使用者
Query OK, 2 rows affected (0.17 sec)
mysql> select user,host from mysql.user; ← 查看使用者資訊
+------+----------------------------+
| user | host |
+------+----------------------------+
| root | localhost |
| root | sample.centospub.com |
+------+----------------------------+
http://blog.163.com/chengwei_1104/blog/static/53645274201271684740219/
CentOS下開啟mysql遠端連線,遠端管理資料庫
2012-08-16 08:47:40| 分類: mysql |舉報|字型大小 訂閱
當伺服器沒有運行php、沒裝phpmyadmin的時候,遠端管理mysql就顯得有必要了。因為在CentOS下設定的,所以標題加上了CentOS,以下的命令在debian等系統下應該也OK。
mysql -u root -p mysql # 第1個mysql是執行命令,第2個mysql是系統資料名稱
在mysql控制台執行:
grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘遠程登入的密碼,可以和本地的不同‘ with grant option;
# root是使用者名稱,%代表任意主機,‘123456‘指定的登入密碼(這個和本地的root密碼可以設定不同的,互不影響)
flush privileges; # 重載系統許可權
exit;
允許3306連接埠
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
# 查看規則是否生效
iptables -L -n # 或者: service iptables status
# 此時生產環境是不安全的,遠端管理之後應該關閉連接埠,刪除之前添加的規則
iptables -D INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
PS,上面iptables添加/刪除規則都是臨時的,如果需要重啟後也生效,需要儲存修改:
service iptables save # 或者: /etc/init.d/iptables save
另外,
vi /etc/sysconfig/iptables # 加上下面這行規則也是可以的
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
遠端管理資料庫的軟體,win系統下可以使用SQLyog,用了幾種遠程軟體,感覺這個用起來蠻不錯的。
webmin
root
系統密碼
伺服器為多網卡,找出到公網的網口.利用-i [port_name]配置允許訪問TCP:22和TCP:1521;其他協議及連接埠預設拒絕.
iptables -A INPUT -i eth1 -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp --dport 10000 -j ACCEPT
iptables -A INPUT -i eth1 -j DROP
運行/etc/rc.d/init.d/iptables save儲存設定檔到/etc/sysconfig/iptables下
運行service iptables restart確認重啟iptables後規則仍有效.
下面是nginx的設定檔已經開了ssl
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘
# ‘$status $body_bytes_sent "$http_referer" ‘
# ‘"$http_user_agent" "$http_x_forwarded_for"‘;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
#20141012add
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header Host $http_host;
#proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:3000/;
#proxy_redirect off;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache‘s document root
# concurs with nginx‘s one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
server {
listen 443 ssl;
server_name localhost;
ssl_certificate /root/project/cloud/ssl-crt.pem;
ssl_certificate_key /root/project/cloud/ssl-key.unsecure;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
proxy_pass http://localhost:3001/;
}
}
}
nodejs for centos配置