I am currently deploying a laravel app to a ubuntu VM, after lots of headache it finally worked and I can see the website in 127.0.0.1:8000 after running php artisan serve ! :)
However, I tried changing the address from localhost to the IP of the server.
my ´/etc/hosts` file looks like this:
127.0.0.1 localhost
132.231.36.101 laravel.dev
127.0.1.1 lehner-grund01
I also tried removing the 127... address as a whole but it didn't change anything.
In my .env file I have this:
APP_NAME=Laravel
APP_ENV=local
APP_KEY=<my_key>
APP_DEBUG=true
APP_URL=http://132.231.36.101
I tried changing the IP in the ServeCommand.php file as well - didn't work either.
My conf file in /etc/apache2/sites-available/ looks like this:
NameVirtualHost *:8080 Listen 8080
<VirtualHost *:8080>
ServerAdmin admin@example.com
ServerName laravel.dev
ServerAlias www.laravel.dev
DocumentRoot grup1/project/tose-gruppe-1/public
<Directory /home/user/projects/laravel_project/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
LogLevel debug
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
I tried doing it "manually" when running php artisan serve to add host like this:
php artisan serve --host=<my_ip> --port
Its the first time I deploy something on an ubuntu machine and I am done haha. Tried for seven hours now, any help appreciated!
Edit: Message when using status command:
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-01-05 21:43:04 UTC; 1h 59min ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 47274 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
Process: 48577 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
Main PID: 47278 (apache2)
Tasks: 8 (limit: 4575)
Memory: 17.2M
CGroup: /system.slice/apache2.service
├─47278 /usr/sbin/apache2 -k start
├─48581 /usr/sbin/apache2 -k start
├─48582 /usr/sbin/apache2 -k start
├─48583 /usr/sbin/apache2 -k start
├─48584 /usr/sbin/apache2 -k start
├─48585 /usr/sbin/apache2 -k start
├─48820 /usr/sbin/apache2 -k start
└─48826 /usr/sbin/apache2 -k start
Jan 05 21:43:04 lehner-tse01 systemd[1]: Starting The Apache HTTP Server...
Jan 05 21:43:04 lehner-tse01 apachectl[47277]: AH00112: Warning: DocumentRoot [/var/www/html/tose-gruppe-1/public] does not exist
Jan 05 21:43:04 lehner-tse01 systemd[1]: Started The Apache HTTP Server.
Jan 05 22:03:58 lehner-tse01 systemd[1]: Reloading The Apache HTTP Server.
Jan 05 22:03:58 lehner-tse01 apachectl[48580]: AH00112: Warning: DocumentRoot [/var/www/html/tose-gruppe-1/public] does not exist
Jan 05 22:03:58 lehner-tse01 apachectl[48580]: AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabl>
Jan 05 22:03:58 lehner-tse01 apachectl[48580]: AH00112: Warning: DocumentRoot [/etc/apache2/grup1/project/tose-gruppe-1/public] does not exist
Jan 05 22:03:58 lehner-tse01 systemd[1]: Reloaded The Apache HTTP Server.
i don't get why the document root directory is wrong, it should be correct