Running apache in an ubuntu Docker container on a RedHat machine - apache

I am new to Docker and have been trying to configure a standard default install of Apache2 running on the ubuntu:14.04 image.
This seems to work just fine when the Docker host machine is running Ubuntu, but when I try to run this same config on a machine running RHEL 6, I get apache config errors having to do with file permissions. Specifically, the default apache page returns a 403 forbidden page.
I thought the point of Docker was that I could create a container on one environment and it should behave exactly the same on any other environment.. am I way off?

Not 100% sure, but it may be that you need RHEL 7. From here you can:
docker pull rhscl/httpd-24-rhel7
See https://access.redhat.com/solutions/1378023

Related

Open a Docker Apache and PHP stack in Browser

I am a Docker rookie who is stuck in configuration. I just wanted to build a docker Apache and PHP Stack with this guide:
Apache and PHP on Docker.
All seems worked except the problem that i don't know how to connect to my created docker container via browser IP/URL. Normally in Apache without Docker you just configure your /etc/hosts file with a ServerName and connect to it.
What is the solution with Docker?
When you run docker, you need to connect the host port with the apache port running inside your container.
This is done by adding -p 8000:80 where 8000 is your local port and 80 is the docker container port.
If you then connect to localhost:8000 you should see the response from apache in your docker container.

How to run flask on apache using mod_wsgi-express on same ip as a subdomain

I want to run flask on apache.I have already installed mod_wsgi-express and my flask application is running on port 8000(localhost:8000) but i want to run my application as a subdomain i dont want to open a new port and want to run the application on same ip using '/'(ex- localhost/application).I have already drupal running on port 80.
So basically i want my drupal run on url(localhost) and flask app on url(localhost/flaskapp) .How can i do this?
Use your main Apache to run mod_wsgi as well, instead of mod_wsgi-express. Use mod_wsgi-express just for development.
Presuming you do not have mod_wsgi installed from a system package, you can run:
sudo mod_wsgi-express install-module
and it will copy the mod_wsgi module into your Apache configuration. The command will also output two lines that you need to include in your main Apache configuration to have it load mod_wsgi and set the correct location for your Python installation or virtual environment.
You should then configure your main Apache installation manually to have it also host your Flask application using mod_wsgi. See the Flask documentation on mod_wsgi for details, but because you still want to run a PHP application, also read:
http://blog.dscpl.com.au/2014/09/hosting-php-web-applications-in.html
Because where you put configuration for Apache depends on the Linux distribution used, can't tell you exactly where you need to put stuff and what steps you may need to do to enable it.

Unable to find httpd directory in Amazon EC2 to configure PhpMyAdmin

I am new to amazon servers. I have Installed PhpMyadmin in my Amazon EC2 server. To access my server's PhpMyadmin from my PC it seems I need to configure some files. According to this link I need to change the file /etc/httpd/conf.d/phpMyAdmin.conf But there's no directory or file named 'httpd' in /etc directory. Where can I find the httpd directory? How can I configure my machine to access phpmyadmin? I almost tried every solution in stackoverflow and none of them worked for me. Any help is appreciable.
First you need to configure web-server on your ec2 instance. You can install apache as a webserver.
For RHEL/Amazon/Fedora Distro issue following commands:-
sudo yum install httpd
Then make changes in /etc/httpd/conf.d/phpMyAdmin.conf according to the Link you are using and restart the apache web server.
sudo service httpd restart
You can access PHPMyAdmin by http://ec2-ip-address/phpmyadmin
For Ubuntu/Debian Distro issue following commands:-
sudo apt-get install apache2
Then make changes in /etc/apache2/conf-enabled/phpmyadmin.conf according to the Link you are using and restart the apache web server.
sudo service apache2 restart
You can access PHPMyAdmin by http://ec2-ip-address/phpmyadmin

Apache2 in docker container gives 403 on statically served files

I'm having a weird issue and am looking for ideas.
I'm running an apache2 debian image that serves some static files, and has a few redirect rules.
Running a container works fine, but results in 403 (permission denied) errors on any request (curl as well as browser).
When I then exec into the container and perform an ls in a static file folder (such as css), those files are being served correctly on the next request.
My current workaround is a startup script with a find /var/www/html/ -name '*'. This makes the container work as expected, with all the served files being accessible.
All the files have the correct owner (www-data) and permissions.
Docker version 1.7.1, but issue appeared also on 1.7.0
I'm running an Ubuntu VM, but my colleague reproduced this on a mac with docker machine.
Whatever could be a reason for this behaviour?

Start nginx on bootup when compiled from source on Ubuntu

On my Ubuntu 13.10 webserver, I installed nginx from source as I read a guide on how to do this in order to run both nginx (for my Rails apps) and Apache2 (for my php apps). I have nginx running as a proxy for apache2 on these php web apps. I installed nginx from source in to /opt/nginx, but I also have the Ubuntu default (using app-get) installed, although it isn't running.
Upon reboot, the Ubuntu default nginx starts up, so I need to manually "service nginx stop", then start the source compiled nginx using /opt/nginx/sbin/nginx.
How can I disable the Ubuntu default nginx from starting on bootup and instead have my source compiled nginx start?
Try going to /etc/init.d/ and modify the path in nginx.