vhosts no DNS
I tried following the instructions from
https://www.linode.com/docs/guides/configure-apache-to-run-multiple-wordpress-sites-on-one-linode/
When I access the
http://ipaddress/ServerName/
I get an error
The requested URL was not found on this server.
8 Replies
✓ Best Answer
@acanton77 writes:
Just a guess… are you sure it shouldn't be /public_html?
It can be whatever you want/need… The directory can be anywhere in the file system as long as it exists and the ownership/permissions are correct.
@andypastor writes:
DocumentRoot "/var/www/myci/public"
ServerName myci.loc
ServerAlias myci.loc *.myci.loc
Without DNS these are just placeholders and do nothing (as, essentially, does <VirtualHost>…). Try changing
<Directory /var/www/myci/public>
to
Alias "/mci.loc" "/var/www/myci/public"
<Directory /var/www/myci/public>
and restart apache2. When you finally get around to setting up the domain mci.loc, you'll remove the Alias.
-- sw
P.S. You don't want to use a wildcard in ServerAlias…enumerate the aliases:
ServerAlias www.mci.loc
ServerAlias www2.mci.loc
etc. Also, you don't need to make a ServerAlias for the name used in ServerName.
P.P.S. The logs are there for a reason. They should be your first resource in determining what's wrong.
P.P.P.S. @andypastor also writes:
it's using the codeigniter 4 framework with a composer installation
You're probably going to want
DirectoryIndex index.php
too…put it before Alias.
Having a peek at your <VirtualHost> configuration would be a great help in answering your question.
Post the vhost configuration between two sets of ``` (backticks…on the key next to 1) to prevent the comment board software from interpreting special characters.
-- sw
<VirtualHost *:80>
DocumentRoot "/var/www/myci/public"
ServerName myci.loc
ServerAlias myci.loc *.myci.loc
ErrorLog "/home/andyp/developer/php/logs/my_ci_error_log"
CustomLog "/home/andyp/developer/php/logs/my_ci_access_log" common
<Directory /var/www/myci/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
# Enable RewriteEngine
RewriteEngine on
RewriteOptions inherit
# Block .svn, .git
RewriteRule \.(svn|git)(/)?$ - [F]
# Recommended: XSS protection
<IfModule mod_headers.c>
Header set X-XSS-Protection "1; mode=block"
Header always append X-Frame-Options SAMEORIGIN
</IfModule>
</VirtualHost>
then I was trying to access to
http://ipaddress/myci.loc/
it's using the codeigniter 4 framework with a composer installation
I realise that I wasn't able to follow Step 3
- If you have not already, assign Linode’s name servers to your domain at your domain name’s registrar.
Will this work if I don't have a domain? Here's my current conf
<VirtualHost *:80>
ServerName myci.loc
ErrorLog "/home/andyp/developer/php/logs/my_ci_error_log"
CustomLog "/home/andyp/developer/php/logs/my_ci_access_log" common
DocumentRoot "/var/www/myci/public"
DirectoryIndex index.php
Alias "/mci.loc" "/var/www/myci/public"
<Directory /var/www/myci/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
I'm getting a 404 when I access http://ip-address/mci.loc/
Will this work if I don't have a domain?
It should. I would add
ServerAlias www.myci.loc
just for anal retentiveness ;-)
If you have a domain, you won't need Alias…DocumentRoot does that for you.
I'm getting a 404 when I access http://ip-address/mci.loc/
Progress… Did you check the error log? That's what it's there for…
My suspicion is that /var/www/myci/public (or some component of the path for ErrorLog/CustomLog) has incorrect ownership or permissions or index.php doesn't exist or PHP is not configured right some such.
-- sw
P.S. I would also change
ErrorLog "/home/andyp/developer/php/logs/my_ci_error_log"
to
LogLevel warn
ErrorLog "/home/andyp/developer/php/logs/my_ci_error_log"
to get more log information. This, again, is for anal retentiveness…
thank you for the assistance you have provided. I think I understand it better now.