Using EndeavourOS and trying to learn about stuff.
I have Hugo running on 192.168.1.137:1313 (using “hugo server”) and can access it on that computer. I try to access this address from another computer on the same network with a browser and get “connection refused”. I’ve turned off firewalls. I know that some servers don’t allow access from other computers, but I would like to learn more about how to debug this. From the second computer I tried:
That really sounds like your Hugo server still has firewall enabled.
Are you using ufw firewall?
Command ifconfig shows ip addresses and masks (hope I remember that right, I’m not at a linux box now). Can you show that output here?
Another reason could be some misconfiguration of the server.
hi @manuel, yes, the server is Linux Mint 19.3 with ufw firewall, status currently off.
Here is the ifconfig for the server, connected by ethernet cable. The client with EndeavourOS does not have a firewall as far as I can tell.
Doing this, have just realised that both client and server have Private Internet Access running and that may be a factor, but have disconnected both and tried to access the server with the same result.
SSH is usually used to share files or communicate with other computers on a network, NFS can be used to share files, but I prefer SSH.
If you want to learn about stuff. here are some instructions about using SSH to communicate and transfer files that I wrote. server instructions
click on download and it will download to the folder specified in your browser.
SET UP A LINUX CLIENT COMPUTER on page 7 might be of interest.
HTH, have fun.
Pudge
Nevermind, I got the cart before the horse again. I should have looked up Hugo Server first, then replied. I just assumed Hugo server was a file server. Ooops, “hugo server, A high performance webserver Synopsis Hugo provides its own webserver which builds and serves the site.”
Sorry, not familiar with Hugo.
Pudge
Edit: I am starting to get what you are doing. You said:
I have Hugo running on 192.168.1.137:1313 (using “hugo server”) and can access it on that computer.
You can do this with localhost, and proves the hugo server is working by creating a local loopback to test the server without going out on a network.
You can’t go to a different computer and connect to the hugo server using localhost because that computer is only talking to itself with localhost. Does that make sense?
To connect to the Hugo server from another computer, you will have to specify it’s address in the client browser. http and https are usually on ports 80 and 435 respectfully. So in the client computer you would have to enter
192.168.1.137:1313 as the URL not localhost. Not sure how it will react on port 1313.
So, a server that is configured to localhost can never be reached by an outside client, if I understand your points.
option 1
Here is the hugo server documentation. Might it possible to configure hugo to be accessible from an outside client on the same network?
hugo help server
Hugo provides its own webserver which builds and serves the site.
While hugo server is high performance, it is a webserver with limited options.
Many run it in production, but the standard behavior is for people to use it
in development and use a more full featured server such as Nginx or Caddy.
'hugo server' will avoid writing the rendered and served content to disk,
preferring to store it in memory.
By default hugo will also watch your files for any changes you make and
automatically rebuild the site. It will then live reload any open browser pages
and push the latest content to them. As most Hugo sites are built in a fraction
of a second, you will be able to save and see your changes nearly instantly.
Usage:
hugo server [flags]
Aliases:
server, serve
Flags:
--appendPort append port to baseURL (default true)
-b, --baseURL string hostname (and path) to the root, e.g. http://spf13.com/
--bind string interface to which the server will bind (default "127.0.0.1")
-D, --buildDrafts include content marked as draft
-E, --buildExpired include expired content
-F, --buildFuture include content with publishdate in the future
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/
--cleanDestinationDir remove files from destination not found in static directories
-c, --contentDir string filesystem path to content directory
-d, --destination string filesystem path to write files to
--disableBrowserError do not show build errors in the browser
--disableFastRender enables full re-renders on changes
--disableKinds strings disable different kind of pages (home, RSS etc.)
--disableLiveReload watch without enabling live browser reload on rebuild
--enableGitInfo add Git revision, date and author info to the pages
--forceSyncStatic copy all files when static is changed.
--gc enable to run some cleanup tasks (remove unused cache files) after the build
-h, --help help for server
--i18n-warnings print missing translations
--ignoreCache ignores the cache directory
-l, --layoutDir string filesystem path to layout directory
--liveReloadPort int port for live reloading (i.e. 443 in HTTPS proxy situations) (default -1)
--meminterval string interval to poll memory usage (requires --memstats), valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". (default "100ms")
--memstats string log memory usage to this file
--minify minify any supported output format (HTML, XML etc.)
--navigateToChanged navigate to changed content file on live browser reload
--noChmod don't sync permission mode of files
--noHTTPCache prevent HTTP caching
--noTimes don't sync modification time of files
--path-warnings print warnings on duplicate target paths etc.
-p, --port int port on which the server will listen (default 1313)
--renderToDisk render to Destination path (default is render to memory & serve from there)
--templateMetrics display metrics about template executions
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
-t, --theme strings themes to use (located in /themes/THEMENAME/)
--trace file write trace to file (not useful in general)
-w, --watch watch filesystem for changes and recreate as needed (default true)
Global Flags:
--config string config file (default is path/config.yaml|json|toml)
--configDir string config dir (default "config")
--debug debug output
-e, --environment string build environment
--ignoreVendor ignores any _vendor directory
--log enable Logging
--logFile string log File path (if set, logging enabled automatically)
--quiet build in quiet mode
-s, --source string filesystem path to read files relative from
--themesDir string filesystem path to themes directory
-v, --verbose verbose output
--verboseLog verbose logging
option 2
hugo can generate html etc for a static website. If I do that would there be a different way to make that website accessible to a client on the same network? There would be no PHP or SQL involved.
Just tried a simple version of option 2, so installed apache2 on the server, then a browser on the server with address localhost, and this gets the apache2 default page.
Then on the client on the same network, http://192.168.1.137 gets the same page.
Server Firewall and PIA are all active.
This must all be on default port 80.
A small
woohoo!
might be permitted here, before working out how to get apache2 to serve the hugo web pages, and why hugo server won’t do the same.
You might want to check the firewall in the router also. Maybe disable it completely first. port 80 is open by default usually, that’s why you might have had results with apache. Also, it’s worth checking in the config files of hugo if it is set to accept external requests (in case there is such a setting).
I know just a little pinch of nothing about Hugo server. For my edification, what are you trying to accomplish with Hugo server? I’m not asking that to be snarky, I am just seeing this as an opportunity for me to learn something.
First time looking at setting up a website, so have to buy a domain, hosting, and work out how to setup the web pages and maintain them. It will be blog style with a few pages for about, contact, etc.
This is an example:
and here are the details:
There are lots of themes available.
The idea of a static website (meaning pages are prebuilt, rather than PHP/SQL) so faster, less to go wrong. Have looked at wordpress.org and other website generators.
The biggest hurdle seems to be understanding networking, so a parameter that’s obvious is easy to miss for me. Have now got access from a client to the server running apache2 only, but the website looks different… via localhost and the same home page from the client
Actually, just checked again, and this wrong rendering happens on localhost as well, so something is different between how hugo server renders the content versus how apache2 renders it. It must be an obvious error on my part.
Will certainly look at nginx as well.All good learning exposure.
I understand. Apache and nginx are general purpose web servers that are a base from which you can design a web page using HTML to be whatever you want. Hugo is designed to be a specific type of server for setting up blog type web pages. Hugo takes care of a lot of the ground work allowing you to concentrate on the blog’s content. I think I have that right. Cool.
In regards to hosting, have you considered hosting the blog yourself? In my case, the web server for my web site sits in my utility room on a shelf, and I use a Dynamic DNS service. Of course this option depends on how much traffic you expect on your site, and what restrictions your ISP provider has or doesn’t have. For Dynamic DNS, I use https://www.noip.com/remote-access and it costs me $25 a year. If you expect high traffic on the site, you’re best off using a hosting service.
Thanks! Just going to have another look at it. Will certainly look into self hosting. Have never bought a domain, but from a learning perspective, self hosting something would make sense, but for a test, would a domain name be needed or could it be done with an ip address.
Yes, for testing within your LAN an IP address will work fine. The host computer should be set up with a static IP address for best results. Down the road, if you want to provide access to the web server from the internet, you will have to look into port forwarding in your router. Don’t make it available to the world without port forwarding.