Site can't be reached when running IIS in Docker - windows

I followed the instructions on the official Dockerhub repo for IIS (https://hub.docker.com/_/microsoft-windows-servercore-iis), but running into "Site can't be reached" when trying to access via the IP of the container.
I get 403 forbidden when I try htp://localhost:8000.
I copied a test.html page into C:/inetpub/wwwroot and verified by logging into the container as well.
The results of appcmd list site is as follows:
SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Started)

403 typically indicates that the web address we are trying to access is not the root directory of the website.
I doubt if there exist any files, which have been copied to the remote docker container.
Please make sure that the directory where the dockerfile is located contains the content folder and contains all site files.
WORKDIR /inetpub/wwwroot
COPY content/ .
Feel free to let me know if the problem persists.

You are right in your analysis. What i didn't realize is IIS perhaps serves index.html as default and my file was called helloworld.html which obviously wasn't going to be to served when i access localhost:8000; it works when i try localhost:8000/helloworld.html.

Related

Golang Server 404 on Static Pages

I am working on a compiled Golang server that displays a home page, and upload page, and a file repository. It can also upload a file to its backend. The goal is to put this into a container and use it.
Code: https://github.com/thatMacAdmin/go-webserver
If I do the following on my local machine:
go run webserver.go
Then it works as expected. The page in /static/index.html loads. I can upload files etc (as long as the repo exists in the right location). However when I build this and put it in a docker container, the repo file list works, and the upload endpoint exists, however the two static html pages get 404 errors.
What am I doing wrong? Why doesn't http://localhost:8080 work to display my home page in the container but it does work with the go run method?
Thanks,
Ed
The issue here was that Docker uses / as its relative path unless you tell it otherwise. In this instance my code expected the relative path to be where my server binary was located. In my case:
/server
Setting the WORKDIR option correctly in my Dockerfile fixed this.
Example:
FROM alpine:latest
RUN mkdir -p /server/static
COPY webserver /server
COPY static /server/static
WORKDIR /server
ENTRYPOINT ["/server/webserver"]
EXPOSE 8080
The static files are not automatically included in your binary. So you need to make sure that the running application working directory (even if it is running within a docker container) contains the folder "static" and its files. Otherwise the file is not found and you get an 404.
One alternative to this is to compile the static files into your binary. You can use gofiles for this.

How to deploy Laravel project in to shared server

I have a Laravel project, I want to deploy it into the server, the thing is that normally we have index.php and .htaccess inside the public folder, but in my case, I have brought these two files into the root. So I want to know, what are the changes needed in serve?
How can I upload this to server?
Solution 1
Somehow you need to get the ssh access as a shared user from your hosting provider and then you can use git to clone your repository into your server.
Solution 2
You can copy paste all of your project into the server using ftp from your cpanel or relevant control panel.
Solution 3
Use Amazon as your hosting as it gives 1 year free tier access, and also gives you ssh service. Follow the solution 1 after getting this.
Put back the files to the public folder. You can change the root path of your server to your project's public folder.
Follow the steps to do:
Go to /etc/apache2/sites-enabled/
Open the .conf file inside this folder
Change the docuementRoot to /etc/var/www/html/project_name/public
Restart the apache server using the following command:
sudo systemctl restart apache2

Directory Listing Denied - FileZilla

I have a website template that I uploaded to my ftp server using FileZilla. However when I visit the domain I get the error:
Directory Listing Denied
This Virtual Directory does not allow contents to be listed.
in the console it displays a 403 forbidden error. After researching I recognize that the default web page inside the root directory is not set. All my attempts to set the default page have failed. Here is what I tried:
1) Logged into ftp server with FileZilla. Clicked File > Site Manager > Advanced and set the root directory. The root directory contains a file that says index.html
2) Created a .htaccess file in the root that contains the text "DirectoryIndex index.html"
Solutions involving IIS are welcomed as well.
Any advice on how I can get this fixed?
Unfortunately I did not have permissions to access the actual server files so I contacted the hosting company.
They resolved my issue I believe using the approach #alvits recommended, however they have not returned my request to confirm how they solved it.
Thanks for the support

Laravel 4.2 in FTP server throwing Error 500

I've searched everywhere for a solution. Plus, I tried tracking the error using echo("teste");, but can't find exactly what is wrong, since it works on my local host.
From index.php -> bootstrap/autoload.php -> vender/autoload.php:
I could print a msg until before the foreach in getLoader method of ComposerAutoloaderInitxxxxxx class.
I see it can't complete the require in both bootstrap/autoload.php or bootstrap/start.php
my directories levels are:
public_html/
|__laravel/
|__app/
|__bootstrap/
|__vender/
|__index.php
|__artisan
|__robots.txt
I've changed the paths correctly when moved the files from public/ to laravel root, since I can get into the files required (it just can't finish loading).
I get
500 (Internal Server Error)
Ps.: I uploaded the project through Filezilla, and I only have the FTP access.
Please, could someone help me with this?
Ok first you should not upload a Laravel project via FTP, if you only have an FTP access then you need a real hosting provider that has SSH. You should be able to use the composer command on your production server or you will be in big trouble later :)
Also, assuming this is a cPanel host (based on the public_html folder) the proper way would be to git clone the Laravel project under a folder, remove the public_html folder and create a symbolic link like this.
ln -s ~/laravel/public ~/public_html
This way your document root will point to Laravel's public folder.
Here is more information:
https://laracasts.com/discuss/channels/general-discussion/how-to-install-laravel-in-the-root-directory

Running goconvey http server from within a docker container

I'm using docker containers for some of my golang web service projects and part of the development workflow is using goconvey for some fast tdd feedback. I'd like to spin this up within a docker container and expose the port to the host machine so I can point my web browser to it and get coding.
We have compiled the goconvey binary and have popped it in /usr/local/bin
The problem is that whenever I connect to the port exposed form the docker container I only get "404 Page not found" errors.
There are a few tweaks we have with out GOPATH specifically I'm vendoring my libs eg GOPATH=/proj-dir/vendor and code dev is happening in /src
I can get goconvey working nicely on my host but in the docker i'm stumped.
The 404 suggest that I'm hitting the goconvey server but it does not serve up anything?
Any assistance appreciated.
The goconvey server returns 404 when it cannot find the directory that contains the static resources.
The location of this directory depends on where go get stored the goconvey files, usually in
$GOPATH/src/github.com/smartystreets/goconvey
So in your docker container, ensure that goconvey is installed using the current $GOPATH value, and also verify that the /goconvey dir contains /web/client/... subdirectories, which is where the html, css, and js files for the Web UI reside.
(To test this, I renamed the client dir, which caused goconvey to return a plain 404 message.)

Resources