从命令行在任何目录中启动 apache 服务器 [英] Start an apache server in any directory from command line

查看:30
本文介绍了从命令行在任何目录中启动 apache 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够从命令行启动 apache 服务器,输入类似 apache site-folderapache 的内容.--port=2000

这应该读取和使用 .htaccess 文件.

我知道 python -m SimpleHTTPServer 并且它接近我需要的东西,但不完全是.

理想的解决方案:

  1. 为 apache 本身贡献了一个很棒的命令行界面
  2. 编写一个简单的命令行工具来包装/包含 apache(或其他东西)
  3. 链接到 apache 现有 cli 上的文档

我只想输入 command --port=8000 --other-options

命令名也可以是pache

有时我可能想在生产中使用它.应该很容易将进程发送到后台,然后停止该实例或所有实例,例如 forever

相关链接:http://httpd.apache.org/docs/2.4/programs/httpd.html

还有

安装脚本以供立即使用应该只是一个命令

解决方案

http-server 是一个比 pache 更好的简单 http 服务器,这是我目前使用的!:)

<块引用>

使用 [pache][1]

使用 npm 安装 - 此处带有节点:http://nodejs.org/

sudo npm install pache -g

在当前目录,端口 3000 上运行:

pache

或者指定目录和端口:

pache 站点目录 2000

[1]:https://github.com/devinrhode2/pache

I want to be able to start an apache server from the command line, typing something like apache site-folder or apache . --port=2000

This should read and use .htaccess files.

I know about python -m SimpleHTTPServer and it's close to what I need, but not quite.

Ideal solutions:

  1. Contributing a great command line interface to apache itself
  2. Writing a simple command line tool that wraps/contains apache (or something)
  3. Linking to docs on an existing cli for apache

I just want to type command <Directory> --port=8000 --other-options

The command name could also be pache

At some point I may want to use this in production. It should be easy to send the process to the background, and then stop that instance or all instances, like forever

Relevant links: http://httpd.apache.org/docs/2.4/programs/httpd.html

Also

It should be only one command for anyone to install the script for immediate use

解决方案

http-server is a much better simple http server than pache, it's what I use currently! :)

Use [pache][1]

Install with npm - which comes with node here: http://nodejs.org/

sudo npm install pache -g

Run on current dir, port 3000:

pache

Or specify directory and port:

pache site-directory 2000

[1]: https://github.com/devinrhode2/pache

这篇关于从命令行在任何目录中启动 apache 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆