I have a docker container running a Centos 7 image. All it needs to do is run a simple Apache2 server. When the container starts it exits immediately with:
AH00526: Syntax error on line 119 of /etc/httpd/conf/httpd.conf:
DocumentRoot '/var/www/html' is not a directory, or is not readable
I did some basic checks:
Folder exists
Permissions are ```rwx r_x r_x root root```` for each folder /var/www/html
Tried chown -R apache /var/www (no straw shall remain unclutched!)
SELinux is disabled (... or is it?)
When I enter the container with a bash entry point, I can then start apache as root with /sbin/httpd -D FOREGROUND and everything works as expected.
So I think its almost certainly a permissions thing. Googling found many pages with my error e.g.
Apache restart causes DocumentRoot must be a directory, even though it is a directory and there seem to be no privilege issues
This particular page closely describes what I am getting and the solution in almost every page is configure SELinux. However SELinux is disabled. Even in that link there is comment from the OP
My version of linux isn't Security Enhanced Linux, so without understanding I tried it anyway: no effect.
Yet they accepted the solution which was configure SELinux.
I think I am missing something, almost certainly SELinux related, but I can't figure it out. The docker image has the following (distinct lack of) SELinux settings:
/etc/selinux contains only semanage.conf and tmp/ (empty)
/usr/sbin contains no se* executables
rpm -qa | grep selinux
libselinux-2.5-12.el7.x86_64
/etc/sysconfig/selinux does not exist
So in the Dockerfile I tried RUN echo "SELINUX=disabled" > /etc/sysconfig/selinux
doing yum install -y policycoreutils installs sestatus in /usr/sbin. Running sestatus gives
SELinux status: disabled
With or without /etc/sysconfig/selinux
It really looks like SELinux is disabled, yet the error looks so much like it is enabled.
The issue in this case was due to the way the container was launched.
I use docker-compose to launch this particular container but the paths for the volume mapping were incorrect.
I am still not sure why this causes apache to fail to start in the way it does but correcting the paths fixed the issue.
Related
I have a Joomla site that the files is owner by root:root. But this way I can't update or install any plugins on Joomla. However when I set de folder's site to the apache owner the site downs return ERROR 500.
How could I fix it?
I've tried set apache owner end set the permissions like below:
chown apache:apache /var/www/html/site
chmod -R 755 /var/www/html/site
Ps.: The site was migrated from another server where the owner of the files is the apache.
Simply run apachectl -S as root or sudo (sudo apachectl -S) and look at the lines which tell User and Group owner.
Other solution, typing the command ps faux will tell you what you need at first column the owner of the process you want to know about.
Also, htop command could help you as same as before if it is installed.
EDIT :
you can also specify -R to do recursive with chown command
I found out the solution. Was just the permissions on files the problem. I don't know why, but when I moved the files of site to another server the folders change the permissions 755 to 655. Changed this permissions everything cames back to normal.
Thanks again!
On a fresh installation of httpd and PHP images and container get to create and work fine. But on restart of my system, httpd stop working. It's not able to find the docroot folder. So is there any setting we need to do for same.
Throw error:
AH00112: Warning: DocumentRoot [/var/www/html/docroot/] does not exist docker error
From the documentation:
Use a restart policy To configure the restart policy for a container,
use the --restart flag when using the docker run command. The value of
the --restart flag can be any of the following:
https://docs.docker.com/config/containers/start-containers-automatically/
You have to start your container in daemon mode:
docker run -d hello-world
Linux Mint 18
Apache2 server
MYSQL Server
Hello! Does anyone have a moment to advise me?
Here's my problem in brief: I am trying to configure phpMyAdmin on a Linux Mint 18 computer, but when I try to view http://localhost/phpmyadmin/, I get a "phpMyAdmin demo server" screen.
Details:
The phpMyAdmin web page begins with an addJSON statement, and echoes this message:
'You are using the demo server. You can do anything here, but please do not change root, debian-sys-maint and pma users'
I understand I am viewing some sort of demonstration page for phpMyAdmin, but I would rather view the actual, familiar phpMyAdmin administration page.
Do I need to edit the Apache2.conf file? Or something else? Thank you very much for your time.
Eric
i had this problem with ubuntu 16.04
fix
1# Remove phpmyadmin completely
sudo apt-get remove phpmyadmin
2# Install phpmyadmin with this command
sudo apt-get install phpmyadmin apache2-utils
3# add phpmyadmin to the apache configuration
sudo nano /etc/apache2/apache2.conf
And put below line to end of the file
Include /etc/phpmyadmin/apache.conf
4# restart apache2
sudo systemctl restart apache2
or
sudo service apache2 restart
I had the same problem, but my error was because I commented the Handler in php.ini
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
I just enable php on apache and start work normal
a2enmod php7.3
I had to disable mpm_event because it was causing some comflict
a2dismod mpm_event
Perhaps PHP code is not being executed, instead code shows on the page or Apache shows php code instead of executing may help.
Linux Mint is similar to Ubuntu/Debian, so you need the libapache2-mod-php5 package installed (assuming you've used the package manager to install the rest of your PHP/Apache stack): sudo apt-get install php5 libapache2-mod-php5.
You can test this further by adding a file (called test.php or phpinfo.php or whatever else suits you) in the main phpMyAdmin folder with the content <?php phpinfo(); ?> -- then try to load that file directly and see if you get a long list of system status or simply the contents of the file displayed. The main reason to put it in the phpMyAdmin folder is that your Apache configuration might handle different folders differently, this is the simplest way to test what happens on that particular folder.
I have a vagrant 1.6.3 debian 7.5 with a TYPO3 6.2.9 installation and I'm trying to make a php file executable
chmod a+x typo3/cli_dispatch.phpsh but it's not working - not even as root.
When I log out, however, I see that the file has changed permissions outside in my host machine.
I tried adding
file {'/home/vagrant/docs/typo3/cli_dispatch.phpsh': mode => 0777} to the puppet manifest, but nothing seems to happen.
Can somebody perhaps shed some light on how to make files executable inside the vagrant box?
reson could be the folder you are working with is protected ,
you can try
chattr -i /home/vagrant/docs/typo3/cli_dispatch.phpsh
and try to change permissions again
I have just made a new setup of Fedora 20 on my laptop, earlier I was using Linux Mint, running NGINX / PHP-FPM.
I have been trying to run php scripts that write files or upload files to server, but I am unable to do so, everything else seems to work fine.
I have already tried the obvious "chmod 777" and "chown -R nginx", etc. but the problem still persists.
Got it working with SELinux enabled,
Last command was:
setsebool -P httpd_can_network_connect 1
Referred to this blog: http://blog.frag-gustav.de/2013/07/21/nginx-selinux-me-mad/