Hi! I’m having a problem with my subdomain. First, I use apache and my main domain is www.wasd.pt which uses WordPress. And now i’m trying to create a subdomain that will host a nodejs server in another port (3000).
I’ve created a A record via Digital Ocean networking panel. I’m looking for quickie.wasd.pt
Added new virtual host on 000-default.conf and this is my actual file:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/www/html/error.log
CustomLog /var/www/html/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =wasd.pt [OR]
RewriteCond %{SERVER_NAME} =www.wasd.pt
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName quickie.wasd.pt
DocumentRoot /var/www/html/quickie
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html/quickie/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
ErrorLog /var/www/html/error-quickie.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/www/html/access-quickie.log combined
# sub:
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://wasd.pt:3000/
ProxyPassReverse / http://wasd.pt:3000/
</VirtualHost>
what intrigues me the most is when i use curl to my subdomain it responds with the html code i’m looking for. Meaning that nodejs is running and working.
What do I need to change more so that the subdomains works?
thanks for you help! IvoPereira
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Can you confirm if created separate configuration files for your websites or are they still in the same file? Can you please separate them just so that it’s more clear going forward?
Additionally, I did understand you want to redirect quickie.wasd.pt to port 3000 but from your last comment it seems like you want to redirect http://quickie.wasd.pt to https//quickie.wasd.pt:3000 rather than http://wasd.pt:3000/ can you confirm to where you want to redirect the subdomain?
Hi @ivobastospereir,
First I’ll recommend separating your Apache configurations for each domain into separate virtual host files. If you are not sure how to do this, check this out
The second thing I’m seeing is that you are trying to reach http://wasd.pt:3000/. I tried to open it up however was unable to. Maybe you’ll need to allow connections on port 3000. Another thing would be instead of using wasd.pt:3000, you can try using localhost:3000 or 127.0.0.1:3000 and not the main domain.
Regards, KFSys