我的目标是从 jira 应用程序 url 中删除端口号。 现在可以通过以下方式访问:
http://192.168.199.151:8080/jira
我想通过以下方式访问它:
http://192.168.199.151/jira
这是我的配置和环境信息:
操作系统:
Ubuntu 16.04.2 LTS
xenial
apachectl -V :
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2017-05-05T16:32:00
Server's Module Magic Number: 20120211:52
Server loaded: APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture: 64-bit
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/etc/apache2"
-D SUEXEC_BIN="/usr/lib/apache2/suexec"
-D DEFAULT_PIDLOG="/var/run/apache2.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="mime.types"
-D SERVER_CONFIG_FILE="apache2.conf"
sudo nano/etc/apache2/apache2.conf:
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
ServerName 192.168.199.151
~/atlassian/jira/conf/server.xml:
<?xml version="1.0" encoding="utf-8"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<Service name="Catalina">
<Connector port="8080"
maxThreads="150"
minSpareThreads="25"
connectionTimeout="20000"
enableLookups="false"
maxHttpHeaderSize="8192"
protocol="HTTP/1.1"
useBodyEncodingForURI="true"
redirectPort="8443"
acceptCount="100"
disableUploadTimeout="true"
bindOnInit="false"
proxyName="192.168.199.151"
proxyPort="80"/>
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="/jira" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">
<Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"
factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
<Manager pathname=""/>
<JarScanner scanManifest="false"/>
</Context>
</Host>
<Valve className="org.apache.catalina.valves.AccessLogValve"
pattern="%a %{jira.request.id}r %{jira.request.username}r %t "%m %U%q %H" %s %b %D "%{Referer}i" "%{User-Agent}i" "%{jira.request.assession.id}r""/>
</Engine>
</Service>
</Server>
最后: /etc/apache2/sites-available.jira.conf:
<VirtualHost *:80>
ServerName 192.168.199.151
ProxyRequests Off
ProxyVia Off
<Proxy *>
Require all granted
</Proxy>
ProxyPass /jira http://localhost:8080/jira
ProxyPassReverse /jira http://localhost:8080/jira
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
RemoteIPHeader X-Forwarded-For
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
一切都在我在 vmware 上的本地虚拟 ubuntu 服务器上运行。 <强> http://192.168.199.151 打开我的 apache2 服务器欢迎页面。
更新:
打开这个http://192.168.199.151/jira
,出现如下错误:
Not Found
The requested URL /jira was not found on this server. Apache/2.4.18 (Ubuntu) Server at 192.168.199.151 Port 80
更新2:
我在 jira.conf 文件中更新了这一行以指向应用程序目录(我不知道是否需要它):
DocumentRoot /home/thomas/atlassian/jira
和添加的位置:
<Location /jira>
Require all granted
</Location
并运行 a2ensite 命令:
sudo a2ensite /etc/apache2/sites-available/jira.conf
我得到这个错误:
ERROR: Site /etc/apache2/sites-available/jira does not exist!
最佳答案
ProxyPass /jira http://localhost:8080/jira
http://192.168.199.151 opens up my apache2 server welcome page.
你要求 Apache 代理/jira,而不是/,所以这个配置不是 还在测试中。否则配置看起来合理。
编辑 404 跟进:
/etc/apache2/sites-available.jira.conf
此站点是否启用了 a2enable?是apachectl -S显示的吗?
关于apache - 从tomcat上的jira应用程序中删除url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44604813/