官方论坛产品帮助刷图视频问题反馈

Debian配置安装Nginx tomcat7 proftpd java in wheezy

发表于 秦海传媒

sudo apt-get update
sudo apt-get install tomcat7
sudo apt-get install openjdk-7-jdk
your_domain_or_ip:8080
sudo apt-get install tomcat7-admin tomcat7-examples tomcat7-docs
vi /etc/default/tomcat7
#修改最后一个AUTHBIND=yes  记得把#去掉。

安装后,有如下重要文件(默认路径)
(1)tomcat7配置文件
/etc/tomcat7/server.xml
/etc/tomcat7/web.xml
/etc/tomcat7/tomcat-user.xml

(2)tomcat7日志文件
/var/log/tomcat7

(3)tomcat7 web默认根目录文件
/var/lib/tomcat7/webapps/ROOT/

sudo apt-get install default-jdk
service tomcat7 start|restart|stop
sudo apt-get install mysql-server
sudo apt-get install proftpd
vi /etc/proftpd/proftpd.conf
useradd luomei -g www-data -d /var/lib/tomcat7/webapps/ROOT/ -s  /sbin/nologin
passwd luomei

如果遇到530错误
——————————-

530 Login incorrect.

——————————-

在shells添加/sbin/nologin

vi /etc/shells 

添加一行

/sbin/nologin 

Debian 7 Linux 修改时区并应用到Tomcat 7

echo "Asia/Shanghai" > /etc/timezone

[转]DirectAdmin自动签发Let’s Encrypt免费证书还可自动更新

发表于 秦海传媒

本文为转载教程,全文转载,本想测试下的但最近几日有一些事情耽搁作罢了,不过已有大量网友验证过的。DirectAdmin就是我们常说的DA,以下原文。

DirectAdmin不用多说相信很多人在用,也有很多主机商因为价格比cPanel更加实惠所以选用DA。

从今天起你可以对你用户说用我的DA主机可以免费签发证书了。

首先确保你主机安装了Git和Composer ,具体安装方法自行搜索,然后执行:
cd /usr/local/directadmin/plugins
git clone https://github.com/Petertjuh360/da-letsencrypt.git da-letsencrypt
cd ./da-letsencrypt/
chown diradmin:diradmin -hR ../da-letsencrypt/
sh ./scripts/install.sh
composer install
chown diradmin:diradmin -hR ../da-letsencrypt/

然后修改/usr/local/directadmin/plugins/da-letsencrypt/plugin.conf

把active=no 和 installed=no 改为 active=yes 以及 installed=yes

管理员登录后台,首页最后有个Let’s Encrypt Certificates  ( 类似这个地方 https://abc.com:2222/CMD_PLUGINS_ADMIN/da-letsencrypt/index.html)

点进去选Let’s Encrypt Live 然后提交。

进入你想管理的用户,同样在首页最后Let’s Encrypt Certificates。

20160102225221

默认根域名是已经包含在内的,其他的需要手动选择,还可以对二级域名签发,但是很少有人会为二级域名也做www的A记录所以记得去掉。

如果有CDN在前端可能要关闭CDN,如果有二级域名没有指向当前DA的ip可能也是无法签发,如果你的域名DNS服务器位于兲朝或者是网络不好。

可能也是无法签发,反正我是没用CDN也只是签了几个二级域名,并且DNS用的国外的一次性签发成功。

20160102225415

然后签发成功后如图。该插件支持自动更新证书,所以每三个月手动更新也免掉了。。

目前该插件仍旧beta中,如果出现新版本更新步骤如下

cd /usr/local/directadmin/plugins/da-letsencrypt
git pull
composer update

原文出处:本文由alect发布在http://www.hostloc.com/thread-301665-1-1.html

Shadowsocks代理共享给局域网内的移动设备

发表于 秦海传媒

本篇为Windows系统下用电脑把Shadowsocks代理共享给局域网里的其他设备的教程(iPhone为例)。

shadowsocks使用教程及账号就在这里不赘述了,网上一大堆。账号自己找或者买,我们这里只介绍把电脑上的代理共享给局域网其他设备的方法。

工具/原料

  • shadowsocks客户端
  • shadowsocks账号

方法/步骤

  1. 首先电脑启动shadowsocks客户端,确保电脑能够翻墙。右键托盘图标,把“允许来自局域网的连接”勾上。

    Shadowsocks代理共享给局域网内的移动设备
  2. 获取电脑的内网IP地址:win键+R输入cmd回车,输入ipconfig回车。我这里是192.168.1.57

    Shadowsocks代理共享给局域网内的移动设备
  3. 双击shadowsocks客户端托盘图标,记住本机代理的端口等会手机端要用。一般默认是1080

    Shadowsocks代理共享给局域网内的移动设备
  4. 手机端,我这里以iPhone为例,绝大部分设备都是支持http代理的,设置方法大同小异。

    打开设置 – 无线局域网 – 点击你所连接的wifi旁边的“i”进入该网络的设置。

    拉到最下面 – HTTP代理 – 点自动。

    在URL里填写你的电脑内网IP地址+端口号+/pac,

    例如我这里就是:http://192.168.1.57:1080/pac

    至此你的iPhone就可以通过电脑的代理进行全局翻墙了,无论是用手机浏览器上网,或者用Facebook、twitter、Instagram等app,都可以畅通无阻。

    (若你的设备没法填URL地址,那么请参考步骤5的填法)

    Shadowsocks代理共享给局域网内的移动设备
  5. 5

    如果局域网内另一台电脑也想通过本电脑进行翻墙浏览网页,那么就要在具体的软件设置http代理,这里以IE浏览器为例:

    设置 – Internet选项 – 连接 – 局域网设置,在代理服务器一栏,勾上为lan使用代理服务器,填法和上面类似。

    服务器地址填上面电脑的内网IP:192.168.1.57

    端口填shadowsocks客户端的代理端口:1080

Configure Multiple Users For Shodwsocks

发表于 秦海传媒

Currently Python and Go servers support multiple users.

You can use different passwords on different ports like this:

{
    "server": "0.0.0.0",
    "port_password": {
        "8381": "foobar1",
        "8382": "foobar2",
        "8383": "foobar3",
        "8384": "foobar4"
    },
    "timeout": 300,
    "method": "aes-256-cfb"
}

If you want to build a user management system, check the Manager API.

 

You can use a configuration file instead of command line arguments.

Create a config file /etc/shadowsocks.json. Example:

{
    "server":"my_server_ip",
    "server_port":8388,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"mypassword",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false
}

Explanation of the fields:

Name Explanation
server the address your server listens
server_port server port
local_address the address your local listens
local_port local port
password password used for encryption
timeout in seconds
method default: “aes-256-cfb”, see Encryption
fast_open use TCP_FASTOPEN, true / false
workers number of workers, available on Unix/Linux

To run in the foreground:

ssserver -c /etc/shadowsocks.json

To run in the background:

ssserver -c /etc/shadowsocks.json -d start
ssserver -c /etc/shadowsocks.json -d stop


cat > /etc/init.d/cron-sserver.sh < > /var/spool/cron/root.cron

Optimizing Shadowsocks

发表于 秦海传媒

If you see a lot of error: too many open files in your log, you should optimize your system. This tutorial applies to all shadowsocks servers (Python, libev, etc).

On Debian 7:

Create /etc/sysctl.d/local.conf with the following content:

# max open files
fs.file-max = 51200
# max read buffer
net.core.rmem_max = 67108864
# max write buffer
net.core.wmem_max = 67108864
# default read buffer
net.core.rmem_default = 65536
# default write buffer
net.core.wmem_default = 65536
# max processor input queue
net.core.netdev_max_backlog = 4096
# max backlog
net.core.somaxconn = 4096

# resist SYN flood attacks
net.ipv4.tcp_syncookies = 1
# reuse timewait sockets when safe
net.ipv4.tcp_tw_reuse = 1
# turn off fast timewait sockets recycling
net.ipv4.tcp_tw_recycle = 0
# short FIN timeout
net.ipv4.tcp_fin_timeout = 30
# short keepalive time
net.ipv4.tcp_keepalive_time = 1200
# outbound port range
net.ipv4.ip_local_port_range = 10000 65000
# max SYN backlog
net.ipv4.tcp_max_syn_backlog = 4096
# max timewait sockets held by system simultaneously
net.ipv4.tcp_max_tw_buckets = 5000
# turn on TCP Fast Open on both client and server side
net.ipv4.tcp_fastopen = 3
# TCP receive buffer
net.ipv4.tcp_rmem = 4096 87380 67108864
# TCP write buffer
net.ipv4.tcp_wmem = 4096 65536 67108864
# turn on path MTU discovery
net.ipv4.tcp_mtu_probing = 1

# for high-latency network
net.ipv4.tcp_congestion_control = hybla

# for low-latency network, use cubic instead
# net.ipv4.tcp_congestion_control = cubic

Then:

sysctl --system

Older system:

sysctl -p /etc/sysctl.d/local.conf

Warning: DO NOT ENABLE net.ipv4.tcp_tw_recycle!!! See this article.

If you use Supervisor, Make sure you have the following line in /etc/default/supervisor. Once you added that line, restart Supervisor (service stop supervisor && service start supervisor).

ulimit -n 51200

If you run shadowsocks in the background in other ways, make sure to add ulimit -n 51200 in your init script.

After optimizing, a busy Shadowsocks server that handles thousands of connections, takes about 30MB memory and 10% CPU. Notice that at the same time, Linux kernel usually uses >100MB RAM to hold buffer and cache for those connections. By using the sysctl config above, you are trading off RAM for speed. If you want to use less RAM, reduce the size of rmem and wmem.

if_eth0-day

fw_conntrack-day

cpu-day

proc_mem-day

Before & after:

cc

Google ADs

除非另有声明,本站文章遵循知识共享署名-非商业性使用 2.5 中国大陆许可协议。 Copyright © 2008-2012 99288.NET.CN.