I would like to know if I can access different folders from the Internet using the same domain.
I am using FCGI, which means that for each project I have a different version of php, locally it works correctly, but from the internet it doesn't and I don't know if it can be done using ports or another way.
In host:
::1 localhost
127.0.0.1 localhost
192.168.2.5 localhost
192.168.2.5 mydomain.ddns.net
192.168.2.5 project1.local
192.168.2.5 project2.local
In httpd.conf:
Defines MYPORT8081 8081
Listen 0.0.0.0:80
Listen [::0]:80
Listen 0.0.0.0:${MYPORT8081}
Listen [::0]:${MYPORT8081}
In httpd-vhost.conf
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp/www
<Directory "c:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName mydomain.ddns.net
DocumentRoot "c:/wamp/www/project1"
<Directory "c:/wamp/www/project1/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
<IfModule fcgid_module>
Defines FCGIPHPVERSION "7.4.22"
FcgidInitialEnv PHPRC ${PHPROOT}${FCGIPHPVERSION}
<Files ~ "\.php$">
Options +Indexes +Includes +FollowSymLinks +MultiViews +ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "${PHPROOT}${FCGIPHPVERSION}/php-cgi.exe" .php
</Files>
</IfModule>
</VirtualHost>
#
<VirtualHost *:${MYPORT8081}>
ServerName mydomain.ddns.net
DocumentRoot "c:/wamp/www/project2/public"
<Directory "c:/wamp/www/project2/public/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
As you can see in Servername is duplicate (wrong), I would like to have the same domain that points to both sites, but when I type in the browser from the internet I can access:
- project1: mydomain.ddns.net
- project2: mydomain.ddns.net:8081
If I put this in ServerName in local (Lan) is working project1: project1.local project2: project2.local
But I would like to access my IP from the internet (wan) through different ports to go to each folder.
If this port option is not possible, is there any other way to access each folder online while respecting the FCGI?
The solution is to create a new domain on the ddns server itself that points to the same IP.
Then in virtualhost you have to assign the new domain to the path where you have the folder, or you can leave that domain to point to everything and you know that this domain is with the version you want, for example: