ラベル 通信 の投稿を表示しています。 すべての投稿を表示
ラベル 通信 の投稿を表示しています。 すべての投稿を表示

2018年1月29日月曜日

Let's Encryptでの更新でエラー

80ポートをListenしていなかったのが原因。

出たエラー


Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for xxxxxxxxx.jp
Using the webroot path /var/www for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. xxxxxxxxx.jp (http-01): urn:acme:error:connection ::
The server could not connect to the client to verify the domain ::
Fetching http://xxxxxxxxx.jp/.well-known/acme-challenge/xxxxxxxxxxxxxxxxxxxx-wk-xxxxxxxxxxxx: Connection refused

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: xxxxxxxxx.jp
   Type:   connection
   Detail: Fetching
   http://xxxxxxxxx.jp/.well-known/acme-challenge/xxxxxxxxxxxxxxxxx-wk-xxxxxxxxxxxxxxx:
   Connection refused

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.

2011年2月8日火曜日

http.confの設定 cgiを動かしたい!

【事件】
あるWEBサーバー(A)に置いてあるexeをキックして(http: //~/hoge.exe)実行しようと、そのパスをクライアントから呼び出してみたところダウンロードの処理が走ってしまう(exeを実行できない)という事象が発生。

http.confを色々探ってみたところ、LoadModule cgi_module "C:/~/mod_cgi.so"
という一文がない為に、cgiの実行ができなかった模様で、これを追加するとダウンロード処理ではなくexeを実行する処理が走りました。

で、一旦解決はしたんですが、
その他の同じような環境(B)のhttp.confを確認してみたところ、それっぽい記載は「LoadModule cgi_module "C:/~/mod_cgi.so"」ではなく「AddModule mod_cgi.c」しかありませんでした。(この設定ファイルをテストしていた環境で使ったらApacheの起動時にAddModuleの部分でエラーが発生しました)

【解決編】↓
AddModuleを使用しているということは、apache1.3系の可能性あり。
確か、AddModuleは2.0になるときに削除されたディレクティブなので。

Aサーバは2.0系で、後に書いた「その他の同じような環境」のサーバが1.3系の可能性が高い。多分、2.×系にAddModuleディレクティブを書いたら、「1.3系のディレクティブが見つかったよ」とエラーが出ているはず。
Bサーバについて、1.3系で「AddModule ~/mod_cgi.c」が書かれているということは、cgiのモジュールは読み込まれているはずなので、後は設定の問題。
exeをcgiとして動かしたいのであれば、exe拡張子をcgi起動できるようにしないといけないので、適当なディレクティブ(動作させたいディレクトリ)に以下を追加。
AddHandler cgi-script .exe
Options ExecCGI
※記載する場所は環境によって違うけど、そのままhttp.confにコンフィグを書いているのであれば、AddHandler、Options共に、追記、もしくは併記(既にhttp.confに存在している場合)してもらえればOK。
多分併記になる
AddHandler cgi-script .cgi と書いてあると思うので
AddHandler cgi-script .cgi .exe
とする。

次に
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
とあると思うので
<Directory />
Options FollowSymLinks ExecCGI
AllowOverride None
</Directory>
とする。

後は、実行してあげれば.exeの拡張子はcgiとして動く。

2011年2月4日金曜日

【java】ポートを使った他端末との通信

サーバーとローカルでのソケット間通信の処理を書く際に、いつもWriterとReaderの選択をミスって時間かかってしまうので、メモしとく。

【送る側】
(MylogSend)
----------------------------------------------------------------
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.net.*;
public class MylogSend {
private static final String host = "000.000.000.000";
public static void main(String[] argv) throws Exception {
MylogSend.write("日本語もOK");
}
public static void write(String msg) {

        System.out.println(host + "に接続します。" );
        PrintWriter out = null;
        try {
            Socket socket = new Socket(host,514);
         // 出力ストリームを取得
            out = new PrintWriter(socket.getOutputStream(), true);
            out.println(msg);
            out.flush();

        } catch (UnknownHostException e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
        } catch (IOException e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
        }
        finally{
            if (out != null) {
                out.close();                
            }
        }
}
}
----------------------------------------------------------------

【受信側】
※コンソール落とすまでずっと受信し続ける
(Startup.class)
----------------------------------------------------------------
public class Startup {
    static receive_data rcdata;
    /**
     * @param args
     */
    public static void main(String[] args) {
        rcdata = new receive_data();
        
        if (args.length > 1) {
            rcdata.intPort = Integer.parseInt(args[0]);
        }
        rcdata.start();    
    }
}
----------------------------------------------------------------
(receive_data.class)
----------------------------------------------------------------
import java.io.*;
import java.net.*;
import java.sql.Time;
import java.util.Date;
public class receive_data extends Thread {
    Date time = new Date();
    public int intPort = 514;
    public String host =  "000.000.000.000";
    public receive_data() {
    }
    ServerSocket svsocket;
    public void receive() throws Throwable{
        InputStreamReader in = null;
        try {
            Socket socket = svsocket.accept();
            InputStream ois = socket.getInputStream();
            in = new InputStreamReader(ois, "SJIS");
            BufferedReader bf = new BufferedReader(in);
            time.setTime(System.currentTimeMillis());
            System.out.println(time.toString());
            String line;
            while ((line = bf.readLine()) != null) {
                System.out.println(line);
            }
        } catch (IOException e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
        }
        finally{
            in.close();
        }
    }
    @Override
    public void run() {
        try {
            svsocket = new ServerSocket(intPort);
            System.out.println("クライアントからの接続をポート"+ intPort + "で待ちます。");
            while (this != null) {
                time.setTime(System.currentTimeMillis());
                System.out.print(time.toString() + "~");
                receive();
            }
        } catch (IOException e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
        } catch (Throwable e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
        }
    }
}
----------------------------------------------------------------