![如何找出我的本地主机所在的端口](https://linux22.com/image/1350733/%E5%A6%82%E4%BD%95%E6%89%BE%E5%87%BA%E6%88%91%E7%9A%84%E6%9C%AC%E5%9C%B0%E4%B8%BB%E6%9C%BA%E6%89%80%E5%9C%A8%E7%9A%84%E7%AB%AF%E5%8F%A3.png)
我遇到了一个有趣的问题,按照指南在本地机器上分别设置mamp地点这是我们设置本地主机时出现的问题,当我访问 localhost/~anderskitson 时,它会带我到我的站点目录,现在那是什么端口?因为我尝试使用的本地隧道需要我所在的端口。
由于 URL 中没有端口,我该如何确定自己所在的端口?
以下是我设置时遵循的步骤
cd /etc/apache2/users
添加
<Directory "/Users/username/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
更新
我在终端运行以下命令
localtunnel -k ~/.ssh/id_rsa.pub 80
但我得到了以下
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find localtunnel (>= 0) amongst [actionmailer-3.2.8, actionpack-3.2.8, activemodel-3.2.8, activerecord-3.2.8, activeresource-3.2.8, activesupport-3.2.8, appscrolls-0.8.4, arel-3.0.2, builder-3.0.4, builder-3.0.0, bundler-1.1.5, coffee-rails-3.2.2, coffee-script-2.2.0, coffee-script-source-1.4.0, coffee-script-source-1.3.3, colorize-0.5.8, erubis-2.7.0, execjs-1.4.0, hike-1.2.1, i18n-0.6.1, i18n-0.6.0, journey-1.0.4, jquery-rails-2.2.0, jquery-rails-2.1.1, json-1.7.6, json-1.7.5, mail-2.4.4, mime-types-1.19, multi_json-1.5.0, multi_json-1.3.6, mysql-2.9.0, polyglot-0.3.3, rack-1.4.4, rack-1.4.1, rack-cache-1.2, rack-ssl-1.3.3, rack-ssl-1.3.2, rack-test-0.6.2, rack-test-0.6.1, rails-3.2.8, railties-3.2.8, rake-10.0.3, rake-0.9.2.2, rdoc-3.12, rubygems-bundler-1.0.7, rubygems-update-1.8.25, rvm-1.11.3.5, sass-3.2.5, sass-3.2.1, sass-rails-3.2.6, sass-rails-3.2.5, sprockets-2.1.3, sqlite3-1.3.7, sqlite3-1.3.6, thor-0.17.0, thor-0.16.0, tilt-1.3.3, treetop-1.4.12, treetop-1.4.10, tzinfo-0.3.35, tzinfo-0.3.33, uglifier-1.3.0, uglifier-1.2.7] (Gem::LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/localtunnel:22:in `<main>'
答案1
除非您另行通知(但您没有通知),否则 Apache 会监听端口 80。
尽管我怀疑您的意思不是这个,但您的问题有点模糊。