Skip to content

Instantly share code, notes, and snippets.

@alejandro
Created April 17, 2013 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alejandro/5406055 to your computer and use it in GitHub Desktop.
Save alejandro/5406055 to your computer and use it in GitHub Desktop.
Running apache in diferent ports and dirs

Sin ser un especialista en Apache o PHP, decidi investigar en como correr diferentes "apps" en diferentes puertos, digo, para tener app1 en el puerto 8080, app2 en el puerto 8082, como normalmente lo haria en Node sin ningún problema.

Investigando me encontré con VirtualHosts y las configuraciones de sites-enabled, así que aqui va una rápida configuración:

/etc/apache2/ports.conf

Para escuchar en el puerto 3010, solo agregar:

NameVirtualHost *:3010
Listen 3010

Luego en /etc/apache2/sites-enabled/000-default en mi caso agregar:


<VirtualHost *:3010>
	ServerAdmin webmaster@localhost

	DocumentRoot /home/alejandro/Documents/code/php
	<Directory />
		Options Indexes +FollowSymLinks
		AllowOverride None
		allow from all
	</Directory>
	<Directory /home/alejandro/Documents/code/php/www/>
		Options Indexes +FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>
	<Directory /home/alejandro/Documents/code/php/www/*>
		Options Indexes +FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>
	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log
	LogLevel warn

	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Donde /home/alejandro/Documents/code/phpes el directorio de la app que quiero cargar con apache.

Y listo :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment