Multiple Hosts on httpd-Apache in Fedora 18 not working
I have moved web development from Ubuntu to Fedora and am having troubles getting set up on my local environment. My set up only needs to be viewed from my laptop only. On Ubuntu my set up worked with the hosts file looking like so:
127.0.0.1 localhost 127.0.0.2 site-1 127.0.0.3 site2 ...
/etc/hosts on my Fedora 18 looks like this:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
I tried adding "site-1 site-2" to the end of each line, also tried adding localhost.site-1 localhost.site-2 as I've seen mentioned.
I also tried adding them to their own line.
hostname looks like so: localhost.localdomain
Here is the httpd file. For conciseness I removed most of documentation but left some of the commands I tried but failed with. My additions are at the bottom.
ServerRoot "/etc/httpd" #Listen 12.34.56.78:80 Listen 80 Include conf.modules.d/*.conf User apache Group apache ServerAdmin root@localhost #ServerName www.example.com:80 #NameVirtualHost *:80 #NameVirtualHost 127.0.0.1 #NameVirtualHost 127.0.0.2 #NameVirtualHost 127.0.0.3 #ServerName localhost #ServerName site-1 #ServerName site-2 <directory/> AllowOverride none Require all denied </directory> #DocumentRoot "/var/www/html*" # Relax access to content within /var/www. # #<directory "="" var="" www"=""> # AllowOverride None # Allow open access: # Require all granted #</directory> # Further relax access to the default document root: #<directory "="" var="" www="" html"=""> # Options Indexes FollowSymLinks # AllowOverride None # Require all granted #</directory> # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <ifmodule dir_module=""> DirectoryIndex index.html </ifmodule> #<files ".ht*"=""> # Require all denied #</files> #ErrorLog "logs/error_log" LogLevel warn <ifmodule log_config_module=""> LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common <ifmodule logio_module=""> # You need to enable mod_logio.c to use %I and %O LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio </ifmodule> #CustomLog "logs/access_log" common CustomLog "logs/access_log" combined </ifmodule> <ifmodule alias_module=""> ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" </ifmodule> <directory "="" var="" www="" cgi-bin"=""> AllowOverride None Options None Require all granted </directory> <ifmodule mime_module=""> TypesConfig /etc/mime.types #AddType application/x-gzip .tgz #AddEncoding x-compress .Z #AddEncoding x-gzip .gz .tgz AddType application/x-compress .Z AddType application/x-gzip .gz .tgz #AddHandler type-map var AddType text/html .shtml AddOutputFilter INCLUDES .shtml </ifmodule> AddDefaultCharset UTF-8 MIMEMagicFile conf/magic #EnableMMAP off EnableSendfile on # Load config files in the "/etc/httpd/conf.d" directory, if any. IncludeOptional conf.d/*.conf # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # Place any notes or comments you have here # It will make any customization easier to understand in the weeks to come # User Defined Multiple Hosting <VirtualHost *:80> # Admin email, Server Name (domain name) and any aliases ServerAdmin webmaster@localhost ServerName localhost ServerAlias localhost # Index file and Document Root (where the public files are located) DirectoryIndex index.html DocumentRoot /var/www/html/localhost/view/site # Custom log file locations LogLevel warn ErrorLog ...
check your SELinux log, '/var/www/html/logs/..' is not the default place for apache log files