0

I needed to setup a local LAMP with a specific version of PHP (7.1). On a brand new install of 18.04, I first installed Apache and MySQL. Then I followed this guide to install PHP from ppa:ondrej/php and finished up with installing phpMyAdmin, which worked fine.

My php install was

sudo apt install php7.1 libapache2-mod-php7.1 php7.1-mysql php7.1-mbstring

For my site test, I ran a virtual hosts script that has worked for me on 16.04. Everything looked like it worked, apart for manually having to chown the public_html directory. My problem is, trying to access my test file at info.dev returns the page error info.dev refused to connect. and ERR_CONNECTION_REFUSED.

PHP seems to be working because I successfully called infophp() from the apache test page.

Can someone suggest something, please?

Here is more info...

v-hosts file in sites-available

<VirtualHost *:80>

    ServerName info.dev
    ServerAlias www.info.dev
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/info.dev/public_html

    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    #CustomLog ${APACHE_LOG_DIR}/access.log combined

    #Include conf-available/serve-cgi-bin.conf

    <Directory /var/www/info.dev/public_html >
        Options Indexes FollowSymLinks MultiViews
        # AllowOverride All allows using .htaccess
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

</VirtualHost>

/etc/hosts file

127.0.0.1   localhost
127.0.1.1   leon

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1   magento.dev
127.0.0.1   info.dev

Some of my access.log:

127.0.0.1 - - [21/Oct/2018:09:24:05 +0300] "GET / HTTP/1.1" 200 315 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
127.0.0.1 - - [21/Oct/2018:09:24:05 +0300] "GET /favicon.ico HTTP/1.1" 404 500 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
::1 - - [21/Oct/2018:09:41:18 +0300] "GET / HTTP/1.1" 200 23933 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36"

Some of my error.log

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
[Sun Oct 21 08:40:11.623382 2018] [mpm_prefork:notice] [pid 32239] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sun Oct 21 08:40:11.623406 2018] [core:notice] [pid 32239] AH00094: Command line: '/usr/sbin/apache2'
[Sun Oct 21 09:27:39.337465 2018] [mpm_prefork:notice] [pid 32239] AH00169: caught SIGTERM, shutting down
[Sun Oct 21 09:41:16.361551 2018] [mpm_prefork:notice] [pid 3368] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sun Oct 21 09:41:16.361651 2018] [core:notice] [pid 3368] AH00094: Command line: '/usr/sbin/apache2'

Permissions

leon@leon:/var/www/info.dev$ ls -l
total 4
drwxr-xr-x 2 leon www-data 4096 loka  21 09:42 public_html
leon@leon:/var/www/info.dev$ cd public_html/
leon@leon:/var/www/info.dev/public_html$ ls -l
total 4
-rw-r--r-- 1 leon leon 22 loka  21 09:42 index.php
leon@leon:/var/www/info.dev/public_html$ 

Ummm...Whatever this is

leon@leon:/var/www/info.dev/public_html$ apachectl -S
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
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
         port 80 namevhost info.dev (/etc/apache2/sites-enabled/info.dev.conf:1)
                 alias www.info.dev
         port 80 namevhost magento.dev (/etc/apache2/sites-enabled/magento.dev.conf:1)
                 alias www.magento.dev
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex default: dir="/var/run/apache2/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used
0

1 Answer 1

2

Ok! After a long time of bashing my head against the keyboard, I realised it is something to do with naming your domain .dev

I tried the same steps with .lan and it worked perfectly.

Not the answer you're looking for? Browse other questions tagged or ask your own question.