Apache2 settings in Ubuntu solve the problem of css and images that cannot be displayed.

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.