#1 2012-12-27 16:04:34
- jackggyy123
- 新生
- 註冊日期: 2011-11-16
- 文章數: 10
- 目前積分 : 0
求助 無法從外網連到 lighttpd
從內網可以連到lighttpd,但是外網不行
我是linux新手,請問如何設定?
netstat -l
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 2548 /tmp/php-fcgi.sock-0
iptables -L | grep 80
ACCEPT tcp -- 59-120-15-172.HINET-IP.hinet.net 80211n tcp dpt:https
ACCEPT tcp -- 59-120-15-172.HINET-IP.hinet.net 80211n tcp dpt:ssh
cat /opt/etc/lighttpd/lighttpd.conf | more
# lighttpd configuration file
#
# use it as a base for lighttpd 1.0.0 and above
#
# $Id: lighttpd.conf 8860 2008-08-05 10:56:16Z engy $
############ Options you really have to take care of ####################
## modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.modules = (
# "mod_rewrite",
# "mod_redirect",
# "mod_alias",
"mod_access",
# "mod_cml",
# "mod_trigger_b4_dl",
# "mod_auth",
# "mod_status",
# "mod_setenv",
# "mod_fastcgi",
# "mod_proxy",
# "mod_simple_vhost",
# "mod_evhost",
# "mod_userdir",
# "mod_cgi",
# "mod_compress",
# "mod_ssi",
# "mod_usertrack",
# "mod_expire",
# "mod_secdownload",
# "mod_rrdtool",
"mod_accesslog" )
## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root = "/opt/share/www/"
## where to send error-messages to
server.errorlog = "/opt/var/log/lighttpd/error.log"
# files to check for if .../ is requested
index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm",
"lighttpd/index.html" )
## set the event-handler (read the performance section in the manual)
# server.event-handler = "freebsd-kqueue" # needed on OS X
server.event-handler = "poll" # needed on OS X
# mimetype mapping
mimetype.assign = (
......
)
# Use the "Content-Type" extended attribute to obtain mime type if possible
#mimetype.use-xattr = "enable"
## send a different Server: header
## be nice and keep it at lighttpd
# server.tag = "lighttpd"
#### accesslog module
accesslog.filename = "/opt/var/log/lighttpd/access.log"
## deny access the file-extensions
#
# ~ is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be part
# of the document-root
url.access-deny = ( "~", ".inc",".sqlite" )
$HTTP["url"] =~ "\.pdf$" {
server.range-requests = "disable"
}
##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".fcgi", ".php", ".pl", ".py", ".rb" )
######### Options that are good to be but not neccesary to be changed #######
## bind to port (default: 80)
server.port = 80
## bind to localhost (default: all interfaces)
#server.bind = "grisu.home.kneschke.de"
## error-handler for status 404
#server.error-handler-404 = "/error-handler.html"
#server.error-handler-404 = "/error-handler.php"
## to help the rc.scripts
server.pid-file = "/var/run/lighttpd.pid"
###### virtual hosts
##
## If you want name-based virtual hosting add the next three settings and load
## mod_simple_vhost
##
## document-root =
## virtual-server-root + virtual-server-default-host + virtual-server-docroot
## or
## virtual-server-root + http-host + virtual-server-docroot
##
#simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
#simple-vhost.default-host = "grisu.home.kneschke.de"
#simple-vhost.document-root = "/pages/"
##
## Format: .html
## -> ..../status-404.html for 'File not found'
#server.errorfile-prefix = "/home/weigon/projects/lighttpd/doc/status-"
## virtual directory listings
#dir-listing.activate = "enable"
## enable debugging
#debug.log-request-header = "enable"
#debug.log-response-header = "enable"
#debug.log-request-handling = "enable"
#debug.log-file-not-found = "enable"
### only root can use these options
#
# chroot() to directory (default: no chroot() )
#server.chroot = "/"
## change uid to (default: don't care)
#server.username = "nobody"
## change uid to (default: don't care)
#server.groupname = "nobody"
#### compress module
#compress.cache-dir = "/tmp/lighttpd/cache/compress/"
#compress.filetype = ("text/plain", "text/html")
#### proxy module
## read proxy.txt for more info
#proxy.server = ( ".php" =>
# ( "localhost" =>
# (
# "host" => "192.168.0.101",
# "port" => 80
# )
# )
# )
#### fastcgi module
## read fastcgi.txt for more info
#fastcgi.server = ( ".php" =>
# ( "localhost" =>
# (
# "socket" => "/tmp/php-fcgi.sock",
# "bin-path" => "/opt/bin/php-fcgi",
# "bin-environment" => (
# "PHP_FCGI_MAX_REQUESTS" => "4000"
# )
# )
# )
# )
#### CGI module
#cgi.assign = ( ".pl" => "/opt/bin/perl",
# ".cgi" => "/opt/bin/perl" )
#
#### SSL engine
#ssl.engine = "enable"
#ssl.pemfile = "server.pem"
#ssl.ca-file = "ca.crt"
#ssl.verifyclient.activate = "enable"
#ssl.verifyclient.enforce = "enable"
#ssl.verifyclient.depth = 1
#### status module
#status.status-url = "/server-status"
#status.config-url = "/server-config"
#### auth module
## read authentication.txt for more info
#auth.backend = "plain"
#auth.backend.plain.userfile = "lighttpd.user"
#auth.backend.plain.groupfile = "lighttpd.group"
#auth.backend.ldap.hostname = "localhost"
#auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
#auth.backend.ldap.filter = "(uid=$)"
#auth.require = ( "/server-status" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "user=jan"
# ),
# "/server-config" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "valid-user"
# )
# )
#### url handling modules (rewrite, redirect, access)
#url.rewrite = ( "^/$" => "/server-status" )
#url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )
#### both rewrite/redirect support back reference to regex conditional using %n
#$HTTP["host"] =~ "^www\.(.*)" {
# url.redirect = ( "^/(.*)" => "http://%1/$1" )
#}
#
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
#evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/"
#### expire module
#expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")
#### ssi
#ssi.extension = ( ".shtml" )
#### rrdtool
#rrdtool.binary = "/opt/bin/rrdtool"
#rrdtool.db-name = "/var/www/lighttpd.rrd"
#### setenv
#setenv.add-request-header = ( "TRAV_ENV" => "mysql://user@host/db" )
#setenv.add-response-header = ( "X-Secret-Message" => "42" )
## for mod_trigger_b4_dl
# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db"
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
# trigger-before-download.trigger-url = "^/trigger/"
# trigger-before-download.download-url = "^/download/"
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
# trigger-before-download.trigger-timeout = 10
## for mod_cml
## don't forget to add index.cml to server.indexfiles
# cml.extension = ".cml"
# cml.memcache-hosts = ( "127.0.0.1:11211" )
#### variable usage:
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
#bar = 1
#var.mystring = "foo"
## integer add
#bar += 1
## string concat, with integer cast as string, result: "www.foo1.com"
#server.name = "www." + mystring + var.bar + ".com"
## array merge
#index-file.names = (foo + ".php") + index-file.names
#index-file.names += (foo + ".php")
#### include
#include /etc/lighttpd/lighttpd-inc.conf
## same as above if you run: "lighttpd -f /etc/lighttpd/lighttpd.conf"
#include "lighttpd-inc.conf"
#### include_shell
#include_shell "echo var.a=1"
## the above is same as:
#var.a=1
# Configuration from other optware packages
include_shell "cat /opt/etc/lighttpd/conf.d/*.conf"
離線
#3 2012-12-28 11:24:07
- jackggyy123
- 新生
- 註冊日期: 2011-11-16
- 文章數: 10
- 目前積分 : 0
Re: 求助 無法從外網連到 lighttpd
我有爬過文,有加入iptable但是不知道哪裡做錯,
請大師給予指點
附件:
2012-12-28_112226.jpg, 大小: 40,052 bytes, 下載: 13
離線
#4 2012-12-31 20:50:13
- jackggyy123
- 新生
- 註冊日期: 2011-11-16
- 文章數: 10
- 目前積分 : 0
Re: 求助 無法從外網連到 lighttpd
話說這個論壇高手這麼多
都沒有人理我嗎?
最後修改: jackggyy123 (2012-12-31 21:04:46)
離線
#6 2013-01-03 09:52:44
- jackggyy123
- 新生
- 註冊日期: 2011-11-16
- 文章數: 10
- 目前積分 : 0
Re: 求助 無法從外網連到 lighttpd
hippo 提到:
說的很清楚了, 站內文章有提過, 算是老問題了.
一個問題丟出來, 別人沒有義務得回答. 在路由器架Web server, 您不是第一個, 也不會是最後一個. 高手所給的答案, 也未必正確, 因為彼此的環境未必都相同, 但總有蛛絲馬跡可當作參考. 很多事情得靠自己測試, 學Linux就是如此. 免費的東西, 能用是福氣; 不能用, 它也沒收費呀, 就當作是經驗吧.
如果附件不能詳述環境,你可以直講我補述,這沒問題!
如果問題太簡單,汙辱你的智商, 至少給個提示,
如果問題太難, 高估你的智商, 至少給iptable成功的範例,
「沒有義務得回答」一句話真棒,
什麼是討論區?
討論區的主旨是什麼?
討論區是幹甚麼用的?
該做什麼?
原來這裡的討論區不准問題!
早說嘛~
離線
#7 2013-01-03 12:44:58
Re: 求助 無法從外網連到 lighttpd
1.可能的解答:
請加在"系統指令"-"防火牆" 試試.
iptables -I INPUT 1 -p tcp --dport (web server port) -j ACCEPT
2.請注意web server port不要被其它程式佔用.(如Tomato GUI 改個非web server port (tcp 80) )
3.我也是從Linux Beginner 過來.也問過問題.出過包.
對於開題者態度.不予置評.但還是建議多問才能多了解.....
最後修改: tom1212 (2013-01-03 12:57:20)
離線
#8 2013-01-04 20:36:12
Re: 求助 無法從外網連到 lighttpd
說實在的, Linux這東西在開發之初, 只是抱著好玩的心態, 分享給眾人使用. 而我們後學之輩想用這免費的東西, 只能盡己所能去嘗試. 如果有注意自由軟體版權等說明事項, 其中都有提到免責聲明. 也就是, 我提供免費的軟體讓你玩, 有任何問題不干我事.
論壇這地方不是不准提問, 而是要換個角度想. 如果我想從別人身上得到答案或解答方向, 則必須禮下於人. 如何將問題提出後, 來誘使別人答覆. 有篇提問的智慧文章就說的蠻詳細的. 同樣的, 提出的問題時常會石沉大海, 這很正常. 若再換個角度, 或更改提問誘因, 或許會有一絲絲機會得到答案.
沒錯, 別人沒有義務得回答. know how這東西不該賤價. 答覆者頂多得到個謝謝, 很多連個謝字也沒有, 沒賺到分毫. 答覆者回覆問題都是基於胸中的一股熱血, 未必求回報.
既然有人提到關鍵字, 就利用關鍵字搜尋該論壇相關文章, 問題或許就可解決. 如果要一問一答, 那等於是廠商客服了. 別忘了, 廠商是有賺錢的. 未得到滿意答覆, 消費者有權翻臉. 免費的東西呢? 想想就知道了. 所以說, 很多事情靠自己比較實在.
P.S. 粗黑的幹字我就收下了.
離線
相關討論主題
主題 | 回覆 | 點閱 | 最後發表 |
---|---|---|---|
lighttpd 與 nginx 問題~ 作者 ezo00001
|
1 | 10436 | 2011-06-22 21:55:11 作者 hippo |
|
38 | 159371 | 2011-06-07 21:01:08 作者 hippo |
[Optware] LightTPD name-based 虛擬主機 作者 hippo
|
0 | 8404 | 2011-05-19 11:56:05 作者 hippo |
1 | 9453 | 2009-12-28 16:36:42 作者 denny | |
0 | 9220 | 2008-11-04 17:58:15 作者 hippo |