7608 questions

9041 answers

14582 comments

11885 members

0 votes
212 views 0 comments
by

This is the config I have set in uhttpd file, do I need something else to enable it?

config uhttpd 'main'

option enablehttp '1'

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'

option script_timeout '600'

option network_timeout '30'

option http_keepalive '20'

option tcp_keepalive '1'

option ubus_prefix '/ubus'

option _httpsWanAccess '1'

option _httpWanAccess '1'

option listen_http '0.0.0.0:80'

option listen_https '0.0.0.0:8443'

1 Answer

0 votes
by

Hi,

This config file (/etc/config/uhttpd) is in part used to configure the web interface, yes. However, the device's firewall actually controls who gets to access what. If you set WAN access via WebUI, it automatically changes configurations in both /etc/config/uhttpd and /etc/config/firewall accordingly. But if you set it via command line, you'll need to edit the firewall config manually as well.

As mentioned previously, the other settings you need are in the /etc/config/firewall file. Open it and look for these two rules:

config rule
        option dest_port '80'
        option proto 'tcp udp'
        option name 'Enable_HTTP_WAN'
        option target 'ACCEPT'
        option src 'wan'
        option enabled '0'

config rule
        option dest_port '443'
        option proto 'tcp udp'
        option name 'Enable_HTTPS_WAN'
        option target 'ACCEPT'
        option src 'wan'
        option enabled '0'

These rules control HTTP and HTTPS WAN access to your device. To enable them, simply delete the options I highlighted in the example above (option enabled '0'). Save the file and restart the firewall service (/etc/init.d/firewall restart) or the entire device to make the changes take effect.


The last thing I would add is that if you're modifying config files with a text editor (like vi), you need to restart the related service after making changes to the config file for these changes to take effect. For example, if you edit /etc/config/uhttpd, you can restart the service with this command:

  • /etc/init.d/uhttpd restart

Hope this helps you with what you need. Perhaps this reference will also come in handy; it's about how to use the UCI system to modify configuration files.

Good luck,
DM