Visualizzazione dei risultati da 1 a 5 su 5

Discussione: Web Server

  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2010
    Messaggi
    132

    Web Server

    Ciao a tutti,
    devo raggiungere un database su un server fisico protetto da vpn.
    Mi hanno aperto una porta sul server Windows che ospita il database (MySql), ho installato un programma java sul server con un HttpHandler che ascolta le richieste, esegue una query sul database e ritorna il risultato.
    L’ Handler è chiamato da una pagina php su un server Windows online che posso contattare da qualunque applicazione.
    Il problema è che quando provo la pagina php sul computer locale funziona , se la metto sul server online da errore : Failed to connect to IP port PORTA: Bad access - Codice errore: 7

    Programma java HttpHandler
    codice:
    HttpServer server = HttpServer.create(new InetSocketAddress(PORTA), 0);
    MyHandler MH=new MyHandler();
    server.createContext("/test", MH);
    
    static class MyHandler implements HttpHandler {
    public void handle(HttpExchange t) throws IOException {
     
    t.sendResponseHeaders(200, jsonString.length());
    OutputStream os = t.getResponseBody();
    os.write(jsonString.getBytes());
    os.close();

    Pagina Php
    Codice PHP:
    $urlWs="IP:PORTA/test";
    $tuCurl curl_init();
    curl_setopt($tuCurl,CURLOPT_URL,$urlWs);
    curl_setopt($tuCurl,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($tuCurl,CURLOPT_HEADERfalse);            
    curl_setopt($tuCurlCURLOPT_CONNECTTIMEOUT,10);
    curl_setopt($tuCurlCURLOPT_TIMEOUT,30);          
    curl_setopt($tuCurlCURLOPT_FOLLOWLOCATIONtrue);
    $result=curl_exec($tuCurl);
    if(
    $result === false) {}
    else {
    }
    curl_close($tuCurl); 


    File web.config del server online con la pagina php
    codice HTML:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
     
                    <system.webServer>
            <staticContent>
                <mimeMap fileExtension=".jnlp" mimeType="application/x-java-jnlp-file" />
                                                   <remove fileExtension=".json" />
                <mimeMap fileExtension=".json" mimeType="application/json" />
            </staticContent>
                                   <directoryBrowse enabled="false" />
            <httpErrors errorMode="Detailed" />
                    </system.webServer>
     
                     <system.webServer>
            <rewrite>
                <rules>
                    <clear />
                    <rule name="Redirect to https" stopProcessing="true">
                        <match url=".*" />
                        <conditions>
                            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                            <add input="{REQUEST_URI}" negate="true" pattern="^/\.well-known/pki-validation/(.*)$" ignoreCase="true" />
                        </conditions>
                        <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="true" />
                    </rule>
                </rules>
            </rewrite>       
                     </system.webServer>
     
    <system.web>
         <identity impersonate="true" />
         <trust level="Medium" />
            <sessionState mode="InProc" sqlCommandTimeout="30" />
    </system.web>
                   
    </configuration>


    Grazie.

  2. #2
    $urlWs="IP:PORTA/test";

    Non è un url valido

    $urlWs="http://IP:PORTA/test";

    Questo è un url valido.

  3. #3
    Utente di HTML.it
    Registrato dal
    Nov 2010
    Messaggi
    132
    Grazie per la risposta, in effetti non cambia, dal computer riesco a connettermi con entrambi gli url, dall' host del sito con nessuno.

  4. #4
    Se il problema non è l'URL potrebbe esserci un firewall che blocca l'accesso.

  5. #5

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.