Multi-sites and 404 of Permalinks issue

Initially, I was going to write something about using Modelica for simulations of HVAC systems. But I have been assigned to other tasks. So, I just share some experience about connecting one IP with multi-domains here.

My server has been running a website already when the server is set for running multi-sites, the original files are reordered for a clean view. I used the method for adding the site to Nginx firstly. But it did not work. While searching for solutions, I realized that my server is mainly using Apache, the easier way was to set up virtual hosts. So the codes added to /etc/httpd/conf/http.conf are as follows:

  1. <VirtualHost *:80>
  2.   ServerAdmin example@example.com
  3.   DocumentRoot /var/www/html/a
  4.   ServerName www.a.com
  5.   ErrorLog /var/log/httpd/a/error_log
  6.   CustomLog /var/log/httpd/a/access_log common
  7. </VirtualHost>
  8. <VirtualHost *:80>
  9.   ServerAdmin example@example.com
  10.   DocumentRoot /var/www/html/b
  11.   ServerName www.b.com
  12.   ErrorLog /var/log/httpd/b/error_log
  13.   CustomLog /var/log/httpd/b/access_log common
  14. </VirtualHost>

Then, I created another database for the other site. Unfortunately, my own site failed to work while opening blogs. The blogs can only work when permalinks are default. Then, the problem is solved by enabling the “mod_rewrite” for the folders that contain WordPress files thanks to Don.

Adding the following codes to /etc/httpd/conf/http.conf.

  1. <Directory “/var/www/html/***”>
  2.   Order allow,deny
  3.   Allow from all
  4.   AllowOverride All
  5. </Directory>

Updated on 7.26.2018

Also, the folders for error logs need to be created.

Bibliography:

https://yq.aliyun.com/ziliao/48568

https://community.rackspace.com/products/f/48/t/3180

Leave a Reply

Your email address will not be published. Required fields are marked *