首页 > 代码库 > nodejs for centos配置
nodejs for centos配置
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刚刚被安装后,存在用户名、密码为空的用户。这使得数据库服务器有无需密码被登录的可能性。为消除隐患,将匿名用户删除。
[root@sample ~]# 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配置