Apache2 settings in Ubuntu solve the problem of css and images that cannot be displayed.
Querying the various sacred aspects further learns about The Apache2 configuration file under Ubuntu, but it cannot solve the problem. The final reason I found was not a "file path error ".
Forecast details, which will be explained tomorrow!
Based on this article, let's take a closer look at The apache2 settings in Ubuntu:
First, go to the configuration file directory:
Cd/etc/apache2
Ls
Apache2.conf envvars magic mod-enabled sites-available
Conf. d httpd. conf mod-available ports. conf sites-enabled
Among them, the familiar configuration file httpd. conf still exists in Windows, but slightly different, many configurations are not completed in httpd. conf, but in apache2.conf;
Apache2.conf does not contain all the configuration content. It allocates the configuration function to several sub-files through Incude: ports. conf, httpd. conf, mod-available/mime. conf, mod-available/dir. conf, sites-available/default, and other files. However, it must be noted that the files in the "mod-enabled" and "sites-enabled" folders are all connected to files in the "mod-available" and "sites-available" folders. They are virtual files.
Tip: if you do not know which file the modified keyword is in, you can use the following statement to query
Grep-iR DirectoryIndex/etc/apache2
The configuration file in the/etc/apache2/mod-available/directory is as follows:
Actions. conf dir. conf mime_magic.conf reqtimeout. conf
Alias. conf disk_cache.conf negotiation. conf setenvif. conf
Autoindex. conf info. conf php5.conf ssl. conf
Cgid. conf ldap. conf proxy_balancer.conf status. conf
Dav_fs.conf mem_cache.conf proxy. conf userdir. conf
Deflate. conf mime. conf proxy_ftp.conf
1. Modify port: ports. conf
2. Modify the default startup path: sites-available/default.
3. Modify the default startup program (html, php): mod-available/dir. conf
4. Set port forwarding: see my other blog posts.
5. Connect images, css, and other things that need to be paid attention to: do not make a wrong path!
After modifying the corresponding configuration, you must restart the apache2 service. Otherwise, the configuration is invalid.
Sudo service apache2 stop/start/restart