首页 > 解决方案 > 如何启动 nostromo 网络服务器?

问题描述

我正在尝试启动 nostromo 网络服务器(http://nazgul.ch/dev_nostromo.html)。编译后,我对配置进行了一些更改。但是当我试图启动“nhttpd”时 - 没有任何反应。哪位大神知道怎么用,没找到攻略。这是我的配置:

# MAIN [MANDATORY]

servername      localhost:80

serverlisten        127.0.0.1
serveradmin     root@localhost
serverroot      /var/nostromo
servermimes     conf/mimes
docroot         /var/nostromo/htdocs
docindex        index.html

# LOGS [OPTIONAL]

logpid          logs/nhttpd.pid
logaccess       logs/access_log

# SETUID [RECOMMENDED]

user            root

# BASIC AUTHENTICATION [OPTIONAL]

#htaccess       .htaccess
#htpasswd       /var/nostromo/conf/.htpasswd
#htpasswd       +bsdauth
#htpasswd       +bsdauthnossl

# SSL [OPTIONAL]

#sslport        443
#sslcert        /etc/ssl/server.crt
#sslcertkey     /etc/ssl/private/server.key

# CUSTOM RESPONSES [OPTIONAL]
#
# The custom responses are searched in the corresponding document root.


# ALIASES [OPTIONAL]

/icons          /var/nostromo/icons

# VIRTUAL HOSTS [OPTIONAL]


# HOMEDIRS [OPTIONAL]

标签: httpwebserver

解决方案


# MAIN [MANDATORY]

servername              127.0.0.1:8080
serverlisten            *
serveradmin             webmaster@nazgul.ch
serverroot              /var/nostromo
servermimes             conf/mimes
docroot                 /var/nostromo/htdocs
docindex                index.html

# LOGS [OPTIONAL]

logpid                  logs/nhttpd.pid
logaccess               logs/access_log

# SETUID [RECOMMENDED]

user                    daemon

# ALIASES [OPTIONAL]

/icons                  /var/nostromo/icons

I have my config file like this. The user option cannot be root. My system is CentOS, so the web daemon user is called daemon. On Debian, it would be www-data.

In addition, you may need to chmod the /var/nostromo/logs directory with all permissions (777).

Then, depending on your system, you start the server as a non-root user with sudo privileges like so:

$ sudo nhttpd

or

$ sudo /usr/local/sbin/nhttpd

If you try to enable IPv6 with the -4 flag, it will complain.

I tried various combinations of these steps and doing all of them was the only way it worked for me. I don't know why this is the case, but it is what it is.

For reference, this is written for nhttpd v1.9.6.


推荐阅读