Java Jetty:在URL中隐藏端口号
我买了一个域名:test.com 然后我通过以下操作运行jetty:Java Jetty:在URL中隐藏端口号,java,maven,jetty,Java,Maven,Jetty,我买了一个域名:test.com 然后我通过以下操作运行jetty: /opt/jetty# nohup java -jar start.jar 当我在我的网站上http://test.com,它不工作,我需要添加端口号,如:http://test.com:8080 这是非常肮脏的。所以,我想删除或隐藏这个端口号 我尝试的是使用如下端口号运行jetty: nohup java -jar start.jar -Djetty.http.port=8080 然后,在/opt/jetty/etc中的
/opt/jetty# nohup java -jar start.jar
当我在我的网站上http://test.com,它不工作,我需要添加端口号,如:http://test.com:8080 这是非常肮脏的。所以,我想删除或隐藏这个端口号
我尝试的是使用如下端口号运行jetty:
nohup java -jar start.jar -Djetty.http.port=8080
然后,在/opt/jetty/etc中的jetty-http.xml文件中,我更改了行:
<Set name="port"><Property name="jetty.http.port" deprecated="jetty.port" default="8080" /></Set>
我正在使用:
瓦丁。
专家
码头。
我应该在哪里管理这个
编辑:
根据需要,这是pom.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>test</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>test</name>
<prerequisites>
<maven>3</maven>
</prerequisites>
<properties>
<vaadin.version>8.0.4</vaadin.version>
<vaadin.plugin.version>8.0.4</vaadin.plugin.version>
<jetty.plugin.version>9.3.9.v20160517</jetty.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<jetty.port>8080</jetty.port>
<vaadin.widgetset.mode>local</vaadin.widgetset.mode>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-compatibility-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-compatibility-client-compiled</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<goal>compile-theme</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/VAADIN/themes</directory>
<includes>
<include>**/styles.css</include>
<include>**/styles.scss.cache</include>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.plugin.version}</version>
<configuration>
<contextPath>/login</contextPath>
<scanIntervalSeconds>2</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
</build>
</project>
为了避免出现问题,我试图删除
8080没有成功
编辑:基于
我试图将LocalHost从/etc/hosts更改为myapplicationname。我重启了码头。而且,它不工作如果我正确理解了问题,您需要使用80端口作为Jetty的一个Jetty.http.port,因为http://test.com/ 意味着端口是默认的-80 其他参考资料: . . 使现代化 这句话稍微澄清了问题: 对不起,我不知道怎样才能提供更多。。我在debian上安装了Jetty 9 -鲍勃 编辑/etc/default/jetty9文件,如下所示:
# Additional arguments to pass to Jetty
JETTY_ARGS=jetty.port=80
# If you run Jetty on port numbers that are all higher than 1023, then you
# do not need authbind. It is used for binding Jetty to lower port numbers.
# (yes/no, default: no)
AUTHBIND=yes
然后,重新启动Jetty服务器:
# service jetty9 restart
这是我在帖子中尝试和描述的。这不是在删除URL中的:8080。@鲍勃,你能通过添加来更新问题,包括pom.xml文件的内容吗?我添加了pom.xml。我认为它不在我的java代码中。。。我的代码中有很多行。我想是在maven或jettyconfiguration@Bob,如果您能提供一个最小但完整的示例来重现问题,那就太好了。