Yes, the answer of Apache and Node.js on the Same Server also works fine on Azure VM.
Generally, you can refer to the following steps:
Enable the 80 port inbound rules of your Azure VM.
Install proxy_module
of apache2 in your Azure VM, via command a2enmod proxy proxy_http
config the Virtual Host in apache configuration file, E.G. as default,
run sudo vim /etc/apache2/sites-available/000-default.conf
, and modify as:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/gary
ServerName <vm_name>.cloudapp.net
<Directory /home/gary>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPass /node http://localhost:1337
ProxyPassReverse /node http://localhost:1337
</VirtualHost>
Restart the apache service: sudo service apache2 restart
Start node server.
Then, directly browse your VM like via <vm_name>.cloudapp.net
will browse the PHP site in the configured directory, and browse via <vm_name>.cloudapp.net/node
will browse the node application.