Apache set up mac os yosemite - apache

I am trying to get Apache to run on my yosemite machine, but when i try to access localhost i get http://i.stack.imgur.com/ZzZzB.png.
I ran an apache configtest and got the following
Angus-Mac:mysql root# apachectl configtest
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using Angus-Mac.local. Set the 'ServerName' directive globally to suppress this message
Syntax OK
What am i getting wrong? any ideas?

Uncommenting the ServerName and changing it to the domain name solved the issue.

change the group permissions on that folder to _www
sudo chgrp -R _www /Library/WebServer/Documents (all web content is now group _www)
chmod -R go-rwx /Library/WebServer/Documents (nobody other than owner can access web content)
chmod -R g+rx /Library/WebServer/Documents (all web content is now readable/executable/enterable by _www)
then restart apache
It seems your user in httpd.conf is different that the one on the web directory
I found the solution here
Please uncomment the ServerName in line 212 (httpd.conf) and change the domain www.example.com to your domain.
Restart apache

Related

Apache (httpd) Wont start because "could not open error log"

ok guys, im stumped. I install centos 7.2 on a vm, installed httpd, enabled it as a service, then started it
then created and edited a config file as follows
<VirtualHost *:80>
ServerAdmin admin#mydomain.com
ServerName www.mydomain.com
ServerAlias mydomain.com
DocumentRoot /var/www/mydomain.com/public_html
#ErrorLog /var/www/mydomain.com/error.log
#CustomLog /var/www/mydomain.com/requests.log combined
</VirtualHost>
So.. When I uncomment the "ErrorLog", which I believe is correct, and there is a file called error.log in directory "/var/www/mydomain.com/"
Httpd.service doesn't want to start, with the error:
(13)Permission denied: AH00091: httpd: could not open error log file /var/www/mydomain.com/error.log.
AH00015: Unable to open logs
I tried doing chown on the error.log file, to apache:apache, and root:root, and the user for the site, but that didn't work.
I also made sure to 755 the directory for www, so the error.log file should be able to be opened by that. Help me out please
Turns out that the error and access logs needed to be placed in /var/log/httpd/ instead of where they were.
All the directories in the path leading up to the error.log must have the executable and readable bit set for the apache user or group, in order for apache to be able to write to the log file.
In order to debug the permissions, you could su to the apache user, and try touching the file:
sudo -u apache touch /var/www/mydomain.com/error.log

Can't access localhost/phpmyadmin on Ubuntu 14.04

I get the "server not found" message in the browser when I try to access localhost/phpmyadmin/ and my websites configured in /etc/hosts and /etc/apache2/sites-enabled.
My "hosts" file:
127.0.0.1 localhost
127.0.1.1 website1
127.0.0.1 website2
...
How can I solve this problem?
Your phpmyadmin configuration might not be included by apache. Open apache.conf using your favorite editor
sudo nano /etc/apache2/apache2.conf
Then add the following line:
Include /etc/phpmyadmin/apache.conf
Then restart your apache server:
sudo service apache restart
Hope this helps.
As mentioned here
A cleaner way is to create the new configuration file:
/etc/apache2/conf-available/phpmyadmin.conf
and write the following in it:
Include /etc/phpmyadmin/apache.conf
then, soft link the file to the directory /etc/apache2/conf-enabled:
sudo ln -s /etc/apache2/conf-available/phpmyadmin.conf /etc/apache2/conf-enabled

Error with DocumentRoot in new Vagrant

I'm attempting to use Jeffrey Way's Vagrant setup (https://github.com/JeffreyWay/Vagrant-Setup) and it almost works for me on a Mac running Yosemite. When Apache restarts at the very end, I get an error stating:
==> default: AH00112: Warning: DocumentRoot [/var/www/html] does not exist
==> default: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Prior to that in his install.sh, he's deleting the html directory and doing a symlink it looks like (I'm new to this, sorry).
To fix it, I ssh into Vagrant, edit /etc/apache2/sites-available/000-default.conf and change the DocumentRoot from /var/www/html to just /var/www and then I'm able to view my site on localhost:8080.
How should I be doing this though so it just works out of the box?
Add the below line after the line sudo ln -fs /vagrant/public /var/www (#38) in install.sh
sed -i "s#DocumentRoot /var/www/html#DocumentRoot /var/www#g" /etc/apache2/sites-available/000-default.conf
Running the updated install script should automatically replace the DocumentRoot from /var/www/html to just /var/www

I've wrongly removed /etc/apache2

I'm wondering whether it's possible to install apache2 from scratch, I tried to install it and many times I was informed that a configuration file was removed, and everytime I chose to install the package responsible version. When starting apache service I have this apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName and the localhost url shows Page Web inaccessible.
How can I fix this?
Thanks in advance.
Just add to apache2.conf
Servername localhost
into last line.
(PATH)
sudo nano /etc/apache2/apache2.conf

start apache with 404 with mac

I'm trying to install start apache2 on my own computer but get some problems:
so when I do:
sudo /usr/local/apache2/bin/apachectl start
it gives me:
httpd: Could not reliably determine the server's fully qualified domain name, using xxxs-MacBook-Pro.local for ServerName
httpd (pid 685) already running
and when Im trying to open "http://localhost/" it gives me 404. Is that because the default directory is wrong?
(I also tried to fix the the servername and in my httpd.conf it has #ServerName www.example.com:##Port##
and I changed it to ServerName localhost but doesn't work.)