How to serve hugo in a specifc domain? - local

I installed Hugo on laragon in local. I put it in a path localhost/hugosite.
When i run "hugo serve" the site is visible in localhost:1313 but i want to show it in "localhost/hugosite". How can i do that? I tried changing the base url in config but nothing seems happened.

You can specify the default HTTP port (80) via -p option.
$ hugo server -b http://localhost/hugosite -p 80

Related

403 Forbidden error when using nginx inside docker

I am trying to build a nginx webserver to share files among team members.
In 'ubuntu 16.04', I am running following command:
root#automation00-new:/home/test# docker run -d -p 8081:80 -v /var/www/apj/:/usr/share/nginx/html --name test-nginx nginx:latest
As shown below docker is able to mount the files successfully.
root#automation00-new:/home/test# docker exec ec795af0f1f2 ls /usr/share/nginx/html
Builds
Logs_for_perf_Testing
json.txt
ravi
root#automation00-new:/home/test#
But when I try to access webserver using browser "http://1.1.1.1/8081" I am seeing '403 forbidden' error.
But if I try 'http://1.1.1.1/8081/json.txt', I am able to view the 'json.txt' contents on browser.
I want to browse all the directories and files inside.
Any idea on how to fix this issue please?
Please give us more context in terms of your nginx configuration.
Are you using the default nginx.conf or do you have done modifications?
The solution should be to add all relevant files to the nginx index
Details also here, you will need to modify your nginx.conf:
autoindex needs to be turned on for the location /

How to configure the port to be exposed for dockerized Rasa-NLU

I'm new with Rasa and docker.
My attempt to dockerize Rasa-NLU consists of the below steps:
Instructions were referred from here
Did a Git clone of latest Rasa-NLU
Copied Dockerfile_full (from within /docker) to the root directory
Changed the port number specified in config_default.json and Dockerfile_full from default(5000) to 5048.
Build using: docker build -t rasa_nlu .
Run the docker on a port(5048) different from the default(5000) port.
However, the following gets logged in the console:
INFO:rasa_nlu.data_router:Logging requests to '/app/logs/rasa_nlu_log-20170928-091903-1.log'.
INFO:__main__:Started http server on port 5000
2017-09-28 09:19:03+0000 [-] Log opened.
2017-09-28 09:19:03+0000 [-] Site starting on 5000
2017-09-28 09:19:03+0000 [-] Starting factory <twisted.web.server.Site instance at 0x7fbab0bfdd40>
If I try to hit the Rasa endpoint locally using CURL, I get a connection reset error. My doubts of a wrong port being referred were confirmed when checked within docker container (using docker exec)it was running on port 5000.
Can someone help me out here as to where exactly I'm going wrong and where should the port number be configured ?
Thanks in advance!
Dockerfile_full expects the config file to be in the sample_configs folder. Also Dockerfile_full uses the config_spacy_duckling.json config file. So make sure you replace the below reference in the dockerfile. You can either change the config file it copies in or change the port configuration in the correct file.
COPY sample_configs/config_spacy_duckling.json ${RASA_NLU_HOME}/config.json
Ignoring that, why change the port in both locations? All you need to do is change it in your docker run or compose command.
docker run -p 5048:5000 rasa/rasa_nlu:latest-full
Add and change port in sample_configs/config_spacy_duckling.json. If you see the Dockerfile this the config that is copied and it has no port defined. So once you put port in this and build it would work

Site can't be reached error using Docker

Aim: I want to see my app running on the outside world.
My Dockerfile is as follows:
FROM node:8.1.0
RUN mkdir /app
WORKDIR /app
RUN npm install
EXPOSE 3000
docker build -name xyz . //ignore any mistakes coz it is working correctly.
docker run -d -p 8100:3000 --name server xyz
In order to run this on the user agent i.e chrome, should I write the url as follows?
ec2 ip: xx.xx.xxx.xx:8100 //is it all correct process from top to down?
When I ran xx.xx.xxx.xx:8100 on the browser the browser shows the site can't be reached.
I believe you missed the part where you need to open the port in the Inbound Rule of the EC2's Security Group. Please see photo below:
Then go to the port 8100 of your DNS or EC2's IP like xx.xx.xxx.xx:8100

Docker on windows: data in mounted volume doesn't updated

I run docker on windows 10 with this command:
docker run -d -v /c/Users/tsh/docker:/usr/share/nginx/html -p 80:80 nginx
Inside Users/tsh/docker folder I have simple index.html file:
<h1>Hello!</h1>
It works perfectly well, when I point my browser on windows to virtualbox IP I can see web page with "Hello!" displayed.
But when I change content of the index.html to something like:
<h1>Hello from docker!</h1>
The web page still shows me the old "Hello!" text.
Is it possible when I change index.html data on the web page is also changed?
Upd:
docker run -it -v //c/Users/tsh/docker:/usr/share/nginx/html -p 80:80 nginx bash
root#ae5fc6b6126a:/# cd /usr/share/nginx/html
root#ae5fc6b6126a:/usr/share/nginx/html# cat index.html
<h1>Hello from docker!</h1>
root#ae5fc6b6126a:/usr/share/nginx/html#
Container see new data <h1>Hello from docker!</h1> but page still shows the old Hello!
This problem appears to be related to Virtualbox caching. I also encountered this problem recently editing CSS and I was able to create a "workaround" by resetting the image in Virtualbox. But, I call this a workaround only in a vague sense since it is not very useful to have to completely reboot the boot2docker image each time you make an edit to an HTML doc.
There seems to be some issues with the windows paths. Please try the workaround suggested in Github issue https://github.com/docker/docker/issues/12590
Use double leading slashes on the path:
docker run -d -v --name mynginx //c/Users/tsh/docker:/usr/share/nginx/html -p 80:80 nginx
You can debug your situation as follows:
First name your container as 'mynginx' using the above updated run command
Then you can enter into the container using following command:
docker exec -it mynginx /bin/bash
Now you should be inside the container, and there you can verify the contents of the mounted file using:
cat /usr/share/nginx/html/index.html
If the file here is showing your changes, and still your browser is showing the old file, that means the file is cached somewhere in the chain. Nginx / browser. If it is cached in the browser, you can check by opening in the incognito window or doing Ctrl + F5.
I had the same problem but with Apache. VirtualBox on Windows and Centos with httpd and php on docker. Problem fixed by changing httpd.conf parameter
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall may be used to deliver
# files. This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults if commented: EnableMMAP On, EnableSendfile Off
#
#EnableMMAP off
EnableSendfile off
EnableSendfile to off because
...but must be turned off when serving from networked-mounted filesystems...
Sending files still works good. Hope this will help someone.

Changing Grafana port

I currently have InfluxDB feeding dashboards in Grafana. I will eventually be deploying this stack on a server.
However, the default port for Grafana is 80. I must change this port, but I don't know how. Can anyone help out?
Thanks.
Not only change in /etc/grafana/grafana.ini you have to change in
/usr/share/grafana/conf/defaults.ini and /usr/share/grafana/conf/sample.ini files. Just search 3000 port(which is default port for grafana) in these three files and replace it with your preferred port.
Here's the easiest way I found.
docker run -d \
-p 2345:2345 \
--name grafana \
-e "GF_SERVER_HTTP_PORT=2345" \
grafana/grafana
See the documentation here.
https://grafana.com/docs/grafana/latest/installation/docker/#configuration
Since Grafana 2.0:
Grafana now ships with its own backend server
You can edit /etc/grafana/grafana.ini (usual location) and change the running port:
[server]
http_port=1234
Source:
http://docs.grafana.org/installation/configuration/
If you are using Linux, you can change the default port by changing the port from /etc/grafana/grafana.ini. There is no separate custom.ini for Linux. For Windows, MacOS or any other platform, check the official documentation.
For opening grafana.ini, you would need sudo privileges. For changing the port please follow the steps below.
Execute sudo gedit /etc/grafana/grafana.ini in a new Terminal window.
Search for 3000 in the `.ini. file and you will find a line similar to the one shown below.
# The http port to use
;http_port = 3000
Remove the semicolon (;) and change the port to the port that you wish to run the grafana server on.
Save the file and close gedit.
You will need to restart the Grafana server for the changes to take place. Run sudo systemctl restart grafana-server.
The grafana server should be started on the port that you provided. Please note that you will have to write systemctl or service depending upon your init system. To determine your init system, run ps --no-headers -o comm 1.
Source
For those using Docker:
Create a grafana.ini:
[server]
http_port = 1234
Update your Dockerfile:
FROM grafana/grafana
EXPOSE 1234
ADD grafana.ini /etc/grafana
Build and run the container:
docker build grafana
docker run \
-d \
-p 1234:1234 \
--name grafana \
grafana/grafana
The EXPOSE is technically optional but is good practice for documentation.
For Linux, I grab the setup file form here
https://grafana.com/grafana/download?platform=linux
Then install it!
You only need to change this one /usr/share/grafana/conf/defaults.ini:
Replace:
http_port = 3000
With
http_port = YourPortYouWant
Then restart your app:
sudo service grafana-server stop
sudo service grafana-server start
To verify you should run:
sudo service grafana-server status
Then you can see the app lives in your desired port:
Open up localhost:yourport to see the result.
I think the document from Grafana should be updated.
On windows,
Change port from 3000 to 3001 in "C:\Program Files\GrafanaLabs\grafana\conf\defaults.ini"
Restart Grafana service from windows services
I know its old thread but for me in Mac i had to make changes at 2 places.
I installed through Brew
/usr/local/etc/grafana/grafana.ini
/usr/local/Cellar/grafana/8.1.5/share/grafana/conf/defaults.ini
Grafana just runs behind a standard web server, like apache. If you are using apache, just update your virtual hosts file to use whatever port you want, and restart apache. Grafana will then be on the new port.
For Windows 10 and Grafana v7.1.1, the following steps made the Grafana to be served in different port:
Navigate to the Grafana "conf" folder location like "C:\Program Files\GrafanaLabs\grafana\conf"
Copy the file "sample.ini" in the same location
Rename the copied sample.ini to "custom.ini"
Edit the "custom.ini" by opening in any editor.The editor must be running as Administrator.
Uncomment the ";http_port = 3000" line by removing the semicolon(;). Note: Semicolon(;) is used to comment out lines in .ini files
Change the port "3000" to whatever port is required. Make sure the new port should be admin rights. I changed to port "3001".
Save the file.
Restart the Windows machine.
The Grafana url is now hosted in "http://localhost:3001/?orgId=1"
You have to remove (;), like this:
http_port = 3900

Resources