Virtual Hosting: How to set WP URL for one of the sites?
-
I’ve been searching and reading and I just cannot seem to find a solution to the same configuration I’m trying out.
I’m running WP on my own personal Linux server (LAMP installed).
Right now, I have it set to an internal access only, but soon plan to hook it to a domain name, etc.My problem is, I cannot figure the correct combination of settings in Apache and WP to get what I like.
1. At this time, this is the only website I have, but I anticipate hosting other domains on this same server so want to get it right now. Future domains may or may not be WP.
2. I am running Gentoo linux as my OS.
3. I’m changing the URLs and IPs..but this will give an idea of my directory structure and what I”m trying to do.
Ok, I currently have my Apache set to document of let’s say:
This is in my default_vhost.include file.
DocumentRoot “/var/www/htdocs”
<Directory “/var/www/htdocs”>
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>In my 00_default_vhost.conf file I have an entry like this:
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
Include /etc/apache2/vhosts.d/default_vhost.include
</VirtualHost>In my WordPress General Settings I have both WordPress and Site URL set to: https://192.168.7.13/wordpress
(again…URLs modified and just for example, but currently using only internal IP addresses so this is similar).
Now, when I put my browser at the url :
https://192.168.7.13/wordpress
As expected, I see my website, all images, etc. working just fine.However, what I need to do, is have my website to be reached from the virtual root domain:
https://192.168.7.13I’ve tried putting this in my VirtualHost markup:
<VirtualHost *:80>
ServerName localhost
Include /etc/apache2/vhosts.d/default_vhost.include
DocumentRoot /var/www/htdocs/wordpress
</VirtualHost>And I *do* see my site…sort of….if I hit the URL:
https://192.168.7.13I see the type, and my links..but the formatting is whacked.
I also tried changing the WP General Settings for Site Address to be the https://192.168.7.13 entry, leaving the WordPress Admin URL the old way. I’ve also tried changing the WordPress Admin URL…
Basically I can’t get the site to look right at the URL I want it to have..I’ve been reading that I also likely need to update the database…I installed the “Better Search Replace”….but I’m not exactly sure what combination I need to do and which steps the order is..to change this.
I’m guessing I”d replace “192.168.7.13/wordpress” with “192.168.7.13”But is this in conjunction with changing the DocumentRoot in my virtual host?
Do I also change this in my General Settings entries?I see many examples of doing something similar to this, by copying your index.php and all to the root directory, but that’s not what I’m wanting to do. Again, there will likely be more sites on this host.
I’m wanting to make the current directory with the WP install into one single virtual host entry…where others may come later.
I think I’m close in the concepts, but am just missing something here.
Again..soon I will replace the IP address and local host with a real domain, but i”M trying to work out how to set up the virtual domain now before I put it live on the web and hook it to a real domain.
Thanks in advance!!
chilecayenne
- The topic ‘Virtual Hosting: How to set WP URL for one of the sites?’ is closed to new replies.