Search code examples
phpubuntuxamppapache2lamp

LAMP stack (Ubuntu1804) can not execute Source web from XAMPP (Windows 10)


I set up a completely LAMP, test with load phpinfo(), it could work well. But when i copy source web from XAMPP (htdocs/news) to /var/www/ . then I create a new virtual host in Apache2 configuration with name news.conf and enable this site (a2ensite news.conf), I already import database to MySQL already. However, it seems that it could not show the website (plz see my attachment). Can anybody give me some advice for my case? ps: I'm using Ubuntu 18.04 bionic, and php7.2, PHP

error screen which I got when ran:

error screen

my configurations as below:

Apache2 virtual host

<VirtualHost *:8080>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/news
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

/etc/apache2/apache2.conf
DefaultRuntimeDir ${APACHE_RUN_DIR}
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
	Options FollowSymLinks
	AllowOverride All
	Require all denied
</Directory>
<Directory /usr/share>
	AllowOverride All
	Require all granted
</Directory>
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
	Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf


Solution

    • Make sure the server can read and write files (ex: in storage folder if your source code is laravel)
    • Check hosts file(/etc/hosts)
    • Read the apache log file.