<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Forum du club des développeurs et IT Pro - Autres langages pour le Web</title>
		<link>https://www.developpez.net/forums/</link>
		<description />
		<language>fr</language>
		<lastBuildDate>Sat, 18 Apr 2026 18:35:08 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>15</ttl>
		<image>
			<url>https://forum.developpez.be/images/misc/rss.png</url>
			<title>Forum du club des développeurs et IT Pro - Autres langages pour le Web</title>
			<link>https://www.developpez.net/forums/</link>
		</image>
		<item>
			<title><![CDATA[[uHTTPd] Configurer un mini serveur sous uHTTPd]]></title>
			<link>https://www.developpez.net/forums/showthread.php?t=2177264&amp;goto=newpost</link>
			<pubDate>Sun, 01 Jun 2025 23:59:00 GMT</pubDate>
			<description>Salut à tous. 
 
Je suis en...</description>
			<content:encoded><![CDATA[<div>Salut à tous.<br />
<br />
Je suis en train de configurer mon routeur OpenWRT version 24.10.0, sous Raspberry Pi 4B. Pour tout ce qui est réseau, il me semble avoir réussi à le faire car j'obtiens bien l'internet sur mes deux bridges (br0, br1) et j'ai j'obtiens les adresses Ipv4 &amp; IPv6 publiques fournies par SFR. Donc, tout va bien de ce coté là.<br />
<br />
J'ai besoin de simuler la box 8 SFR et c'est là que j'ai des problèmes car je ne connais pas &quot;<b><font color="red">uHTTPd</font></b>&quot;, le serveur WEB léger ou minimaliste. Voici le fichier de configuration &quot;/etc/config/uhttpd&quot; :<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><table cellspacing="0" cellpadding="0"><tr><td valign="top" width="33"><div style="border: 1px dashed gray; padding-left: 5px; padding-right: 5px; margin-right: 5px; text-align: right; font-family: monospace">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br /></div></td><td valign="top"><pre style="margin: 0">config uhttpd 'main'
	list listen_http '0.0.0.0:80'
	list listen_http '[::]:80'
	list listen_https '0.0.0.0:443'
	list listen_https '[::]:443'
	option redirect_https '0'
	option home '/www'
	option rfc1918_filter '1'
	option max_requests '3'
	option max_connections '100'
	option cert '/etc/uhttpd.crt'
	option key '/etc/uhttpd.key'
	option cgi_prefix '/cgi-bin'
	list lua_prefix '/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua'
	option script_timeout '60'
	option network_timeout '30'
	option http_keepalive '20'
	option tcp_keepalive '1'
	option ubus_prefix '/ubus'

config cert 'defaults'
	option days '397'
	option key_type 'ec'
	option bits '2048'
	option ec_curve 'P-256'
	option country 'ZZ'
	option state 'Somewhere'
	option location 'Unknown'
	option commonname 'OpenWrt'</pre></td></tr></table></code><hr />
</div>C'est la version d'origine, non modifié.<br />
<br />
Il existe déjà un répertoire /www&quot; avec un sous répertoire /cgi-bin&quot; contenant &quot;LUCI&quot;. Pour simuler la BOX 8 SFR, j'ai créé le répertoire /www/api/1.0&quot;, afin d'y mettre les fichiers &quot;*.xml&quot; et un script a priori &quot;cgi&quot;. Mon problème est que je sais le faire sous Apache, mais pas sous uHTTPd.<br />
<br />
Dans mon OpenWRT, j'ai créé deux bridges, l'un nommé br0 avec l'adresse 10.0.0.1 et l'autre nommé br1 avec l'adresse 192.168.1.1.<br />
<br />
Remarque: Je ne vais pas préfixer mes url par &quot;http://&quot; car je ne veux pas que cela apparaisse dans ce sujet comme des liens à cliquer.<br />
<br />
Je veux que uHTTPd interpréte cet url que voici : &quot;192.168.1.1/api/1.0/?method=ftth.getInfo&quot;.<br />
Ce chemin &quot;/api/1.0/&quot; va devoir exécuter (sous apache, on parle de redirection) un script &quot;cgi&quot; qui va retourner le fichier qui se trouve dans le paramètre de &quot;?method=...&quot;.<br />
<br />
Mon script &quot;cgi&quot; se nomme &quot;gateway.cgi&quot;. Il a les droits &quot;root&quot;, il est exécutable et il se trouve dans le répertoire &quot;/www/cgi-bin&quot;. Si je tape dans google : &quot;192.168.1.1/cgi-bin/gateway.cgi&quot;, il s'exécute, ce qui est correcte.<br />
<br />
Oui, mais voilà, je ne sais pas comment modifier le fichier de configuration uHTTPd afin que l'url &quot;192.168.1.1/api/1.0/?method=ftth.getInfo&quot; pointe vers le chemin du script cgi &quot;/etc/cgi-bin/gateway.cgi&quot; et s'excéute en retournant le contenu du fichier &quot;/www/api/1.0/ftth.getInfo.xml&quot;.<br />
<br />
Il y a déjà un existant &quot;LUCI&quot; et j'aimerai avoir encore l'accès par le navigateur google.<br />
<br />
Voici le fichier &quot;gateway.cgi&quot; :<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code"><table cellspacing="0" cellpadding="0"><tr><td valign="top" width="33"><div style="border: 1px dashed gray; padding-left: 5px; padding-right: 5px; margin-right: 5px; text-align: right; font-family: monospace">1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></div></td><td valign="top"><pre style="margin: 0">#!/bin/sh

METHOD=$(echo &quot;$QUERY_STRING&quot; | sed -n 's/.*method=\([^&amp;]*\).*/\1/p')

case &quot;$METHOD&quot; in
	ftth.getInfo)		FILE=&quot;ftth.xml&quot;   ;;
	lan.getHostsList)	FILE=&quot;lan.xml&quot;    ;;
	system.getInfo)		FILE=&quot;system.xml&quot; ;;
	tv.getInfo)			FILE=&quot;tv.xml&quot;     ;;
	usb.getInfo)		FILE=&quot;usb.xml&quot;    ;;
	wan.getInfo)		FILE=&quot;wan.xml&quot;    ;;
	*)
		echo &quot;Status: 404 Not Found&quot;
		echo &quot;Content-type: text/html&quot;
		echo
		echo &quot;Method not found&quot;
		exit 0
		;;
esac

echo &quot;Content-type: application/xml&quot;
echo
cat &quot;/www/api/$FILE&quot; 2&gt;/dev/null || echo &quot;XML file not found&quot;</pre></td></tr></table></code><hr />
</div>Merci de m'avoir lu.<br />
Cordialement.<br />
Artemus24.<br />
@+</div>

]]></content:encoded>
			<category domain="https://www.developpez.net/forums/f62/webmasters-developpement-web/autres-langages-web/">Autres langages pour le Web</category>
			<dc:creator>Artemus24</dc:creator>
			<guid isPermaLink="true">https://www.developpez.net/forums/d2177264/webmasters-developpement-web/autres-langages-web/uhttpd-configurer-mini-serveur-sous-uhttpd/</guid>
		</item>
	</channel>
</rss>
