Domanda

That is my first time configuring the virtual host for local work and tests in my computer. I'm trying to access the blog.dev that I configurate on sites-available/default, but it isn't working. Here's my sites-available/default:

<VirtualHost *:80>
    ServerAdmin eduguimara@gmail.com

    ServerName blog.dev
    ServerAlias www.blog.dev
    DocumentRoot /var/www/crud/public
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /var/www/crud/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride All
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined
    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>

I did the sudo a2ensite blog.dev.conf and sudo service apache2 restart. According to the guides, helps and tutorials that I found, it should be running. But my browser can't find the http://blog.dev .
When I type localhost, it still works, but the ServerName isn't working. The NameVirtualHost *:80 is ok on ports.conf.
I tried configuring a new file called blog.dev.conf in the sites-available/ directory, but it still not working.

È stato utile?

Soluzione

If blog.dev isn't a real domain and you don't have a DNS entry pointing to your server then you will need to add a fake entry into your system's hosts file so the domain name can be resolved.

Under windows you can add the entry to the hosts file located here: c:\windows\system32\drivers\etc\hosts

Then as THEcreationist said, add 127.0.0.1 blog.dev on a line by itself.

For linux environments see THEcreationist's response.

By the sounds of it that should fix your problem.

Altri suggerimenti

You need to put the following entry in your /etc/hosts file:

127.0.0.1    blog.dev
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top