start apache with 404 with mac - apache

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.)

Related

Apache set up mac os yosemite

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

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

Specific Port Configuration on Apache

So I'm trying to develop a php website locally on my macbook. I'm using apache as my webserver, I have php and mysql installed, and I can use the php index file in my sites folder, but I would like to move all of my development over to a different.
I've been trying to configure apache to run on a different port, so far I've made these changes to my /etc/apache2/extras/httpd-vhost.conf
<VirtualHost *:2727>
ServerAdmin foobar#gmail.com
DocumentRoot "/Users/brianWheeler/Foobar"
ServerName local.foobar.com
</VirtualHost>
And i've edited my /etc/apache2/httpd.conf to say
listen 127.0.0.1:2727 http
I've started apache, but when I go to 127.0.0.1:2727 I get the google chrome page not found type thing.
I've run apachectl -t command to see whats wrong, and I just get this one error
httpd: Could not reliably determine the server's fully qualified domain name, using Foo-Bars-MacBook.local for ServerName
So my questions are, how do I configure the DocumentRoot/index page, and what kind of diagnostics can I run to see why this won't work?
-Brian
httpd: Could not reliably determine the server's fully qualified domain name, using Foo-Bars-MacBook.local for ServerName - this error possibly is not related with your problem.
most of my test server are giving this error but they are running with no problem.
please try to insert the line without ip and http,
listen 2727
edit: can you try following:
NameVirtualHost *:2727
Listen 2727

My localhost apache server isn't showing my index.html

Recently, my localhost apache server stopped showing my index.html. It just shows "It works!" now. I'm not sure what to do. My httpd.conf file looks fine, but this is it:
http://pastebin.com/JQSEMUTy
and when I attempt to restart my apache server it gives:
httpd: Could not reliably determine the server's fully qualified domain name, using Richard-Lus-MacBook-Pro.local for ServerName
Thanks in advance!
I guess there was an update..?
DocumentRoot "/sites"
is this the document root you are using? If not, fix it. Also, set your servername:
ServerName www.example.com:80