This setup is simple, first step and put apache to listen on the port you want, the second step and configure vhost to point the port to a directory you want loaded when prompted, after that and only give a Reload or Restart service.
First step
In some OS you will find this option in httpd.conf, if it is in Debian you will find in /etc/apache2/ports.conf
Listen 81
Listen 80
Second step
In some OS you will find this option in httpd.conf, if it is in Debian you will find in /etc/apache2/sites-available/, to enable in Debian and only run the command a2ensite [configuration file name].
<VirtualHost *:81>
#ServerName localhost
DocumentRoot /srv/www_81
</VirtualHost>
<VirtualHost *:80>
#ServerName localhost
DocumentRoot /srv/www_80
</VirtualHost>
Note: The Servername is commented due to no need to specify a hostname, if you have a valid and public domain can this putting.
~# service apache2 reload
or
~# service apache2 restart
Following example
To facilitate follow an example of the case informed, using the same port changing only the address (host).
Host
127.0.0.1 projeto.dev
127.0.0.1 localhost81
Create 2 files inside the folder called alias, which was created by you.
project81.conf
<VirtualHost *:80>
DocumentRoot C:/www81/projeto/public
ServerName localhost81
<Directory "C:/www81/projeto/public">
Require all granted
</Directory>
</VirtualHost>
project_dev.conf
<VirtualHost *:80>
DocumentRoot C:/www/projeto/public
ServerName projeto.dev
<Directory "C:/www/projeto/public">
Require all granted
</Directory>
</VirtualHost>
Inside the httpd.conf file remains the way you have already configured it.
I believe is in a way suitable for what you want and do not need to specify the port :), will only change the host (address) typed in the browser URL.
Att.
Are you in linux environment? Using some xampp or installed apache and PHP natively?
– lpFranz
PHP and Apache separate
– adventistaam
In Windows environment
– adventistaam