简体   繁体   English

如何在任意目录启动Apache2?

[英]How to start Apache2 in any directory?

I'm an apache2 and PHP beginner.我是 apache2 和 PHP 初学者。

With other servers I'm used to just running them like对于其他服务器,我习惯于像这样运行它们

CoolServer /directory/to/my_website

This is very useful when working on multiple different websites stored in multiple different directories.这在处理存储在多个不同目录中的多个不同网站时非常有用。

But apache2 only seems to run for ONE directory that is explicitly listed in a conf file ( /var/www/html by default ).但是 apache2 似乎只针对在conf文件中明确列出的一个目录运行(默认为/var/www/html )。

Is there a way to just get apache2 to run like:有没有办法让 apache2 像这样运行:

apache2 /directory/to/website1

apache2 /another/directory/website2

You could use PHP built-in web server.您可以使用 PHP 内置的 web 服务器。 If you are using Windows OS then link PHP to your PATH.如果您使用的是 Windows 操作系统,则将 PHP 链接到您的路径。 And, goto to your project's root folder, open command prompt, and type:-然后,转到项目的根文件夹,打开命令提示符,然后键入:-

php -S localhost:8000

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM