配置不同二级域名访问不同端口的应用

一,简单配置方法:

1、记录类型选择隐形URL

2、记录值解析到一级域名对应的端口

(阿里云的好像不太灵)

二、Apache配置代理:

1、http.conf:

NameVirtualHost *:80
<VirtualHost *:80>
        ServerAdmin liang.top
        ServerName www.ccc.top
        ServerAlias ccc

</VirtualHost>

#<VirtualHost *:80>
#        ServerAdmin share.top
#        ServerName share.ccc.top
#        ServerAlias ccc_share
#        ProxyPass "/" "http://127.0.0.1:8880/"
#        ProxyPassReverse "/" "http://127.0.0.1:8880/"
#</VirtualHost>

<VirtualHost *:80>
        ServerAdmin transcode.top
        ServerName transcode.cccc.top
        ServerAlias ccc_transcode

        ProxyPass "/" "http://transcode.cccc.top:8881/"
        ProxyPassReverse "/" "http://transcode.cccc.top:8881/"

</VirtualHost>

三、加一个https的配置:

#
# When we also provide SSL we have to listen to the
# the HTTPS port in addition.
#
Listen 443 https

##
##  SSL Global Context
##
##  All SSL configuration in this context applies both to
##  the main server and all SSL-enabled virtual hosts.
##

#   Pass Phrase Dialog:
#   Configure the pass phrase gathering process.
#   The filtering dialog program (`builtin‘ is a internal
#   terminal dialog) has to provide the pass phrase on stdout.
SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog

#   Inter-Process Session Cache:
#   Configure the SSL Session Cache: First the mechanism
#   to use and second the expiring timeout (in seconds).
SSLSessionCache         shmcb:/run/httpd/sslcache(512000)
SSLSessionCacheTimeout  300

#   Pseudo Random Number Generator (PRNG):
#   Configure one or more sources to seed the PRNG of the
#   SSL library. The seed data should be of good random quality.
#   WARNING! On some platforms /dev/random blocks if not enough entropy
#   is available. This means you then cannot use the /dev/random device
#   because it would lead to very long connection times (as long as
#   it requires to make more entropy available). But usually those
#   platforms additionally provide a /dev/urandom device which doesn‘t
#   block. So, if available, use this one instead. Read the mod_ssl User
#   Manual for more details.
SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin
#SSLRandomSeed startup file:/dev/random  512
#SSLRandomSeed connect file:/dev/random  512
#SSLRandomSeed connect file:/dev/urandom 512

#
# Use "SSLCryptoDevice" to enable any supported hardware
# accelerators. Use "openssl engine -v" to list supported
# engine names.  NOTE: If you enable an accelerator and the
# server does not start, consult the error logs and ensure
# your accelerator is functioning properly.
#
SSLCryptoDevice builtin
#SSLCryptoDevice ubsec

##
## SSL Virtual Host Context
##

<VirtualHost *:443>

# General setup for the virtual host, inherited from global configuration
DocumentRoot "/var/www/html"
ServerName www.cccc.top:443

# Use separate log files for the SSL virtual host; note that LogLevel
# is not inherited from httpd.conf.
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn

#   SSL Engine Switch:
#   Enable/Disable SSL for this virtual host.
SSLEngine on

#   SSL Protocol support:
# List the enable protocol levels with which clients will be able to
# connect.  Disable SSLv2 access by default:
SSLProtocol all -SSLv2 -SSLv3

#   SSL Cipher Suite:
#   List the ciphers that the client is permitted to negotiate.
#   See the mod_ssl documentation for a complete list.
SSLCipherSuite HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA

#   Speed-optimized SSL Cipher configuration:
#   If speed is your main concern (on busy HTTPS servers e.g.),
#   you might want to force clients to specific, performance
#   optimized ciphers. In this case, prepend those ciphers
#   to the SSLCipherSuite list, and enable SSLHonorCipherOrder.
#   Caveat: by giving precedence to RC4-SHA and AES128-SHA
#   (as in the example below), most connections will no longer
#   have perfect forward secrecy - if the server‘s key is
#   compromised, captures of past or future traffic must be
#   considered compromised, too.
#SSLCipherSuite RC4-SHA:AES128-SHA:HIGH:MEDIUM:!aNULL:!MD5
SSLHonorCipherOrder on

#   Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate.  If
# the certificate is encrypted, then you will be prompted for a
# pass phrase.  Note that a kill -HUP will prompt again.  A new
# certificate can be generated using the genkey(1) command.
SSLCertificateFile /etc/httpd/cert/www.cccc.top_public.crt

#   Server Private Key:
#   If the key is not combined with the certificate, use this
#   directive to point at the key file.  Keep in mind that if
#   you‘ve both a RSA and a DSA private key you can configure
#   both in parallel (to also allow the use of DSA ciphers, etc.)
SSLCertificateKeyFile /etc/httpd/cert/www.cccc.top.key

#   Server Certificate Chain:
#   Point SSLCertificateChainFile at a file containing the
#   concatenation of PEM encoded CA certificates which form the
#   certificate chain for the server certificate. Alternatively
#   the referenced file can be the same as SSLCertificateFil
#   when the CA certificates are directly appended to the server
#   certificate for convinience.
SSLCertificateChainFile /etc/httpd/cert/www.cccc.top_chain.crt

#   Certificate Authority (CA):
#   Set the CA certificate verification path where to find CA
#   certificates for client authentication or alternatively one
#   huge file containing all of them (file must be PEM encoded)
#SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt

#   Client Authentication (Type):
#   Client certificate verification type and depth.  Types are
#   none, optional, require and optional_no_ca.  Depth is a
#   number which specifies how deeply to verify the certificate
#   issuer chain before deciding the certificate is not valid.
#SSLVerifyClient require
#SSLVerifyDepth  10

#   Access Control:
#   With SSLRequire you can do per-directory access control based
#   on arbitrary complex boolean expressions containing server
#   variable checks and other lookup directives.  The syntax is a
#   mixture between C and Perl.  See the mod_ssl documentation
#   for more details.
#<Location />
#SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ #            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." #            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} #            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 #            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) #           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
#</Location>

#   SSL Engine Options:
#   Set various options for the SSL engine.
#   o FakeBasicAuth:
#     Translate the client X.509 into a Basic Authorisation.  This means that
#     the standard Auth/DBMAuth methods can be used for access control.  The
#     user name is the `one line‘ version of the client‘s X.509 certificate.
#     Note that no password is obtained from the user. Every entry in the user
#     file needs this password: `xxj31ZMTZzkVA‘.
#   o ExportCertData:
#     This exports two additional environment variables: SSL_CLIENT_CERT and
#     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
#     server (always existing) and the client (only existing when client
#     authentication is used). This can be used to import the certificates
#     into CGI scripts.
#   o StdEnvVars:
#     This exports the standard SSL/TLS related `SSL_*‘ environment variables.
#     Per default this exportation is switched off for performance reasons,
#     because the extraction step is an expensive operation and is usually
#     useless for serving static content. So one usually enables the
#     exportation for CGI and SSI requests only.
#   o StrictRequire:
#     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
#     under a "Satisfy any" situation, i.e. when it applies access is denied
#     and no other module can change it.
#   o OptRenegotiate:
#     This enables optimized SSL connection renegotiation handling when SSL
#     directives are used in per-directory context.
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
    SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>

#   SSL Protocol Adjustments:
#   The safe and default but still SSL/TLS standard compliant shutdown
#   approach is that mod_ssl sends the close notify alert but doesn‘t wait for
#   the close notify alert from client. When you need a different shutdown
#   approach you can use one of the following variables:
#   o ssl-unclean-shutdown:
#     This forces an unclean shutdown when the connection is closed, i.e. no
#     SSL close notify alert is send or allowed to received.  This violates
#     the SSL/TLS standard but is needed for some brain-dead browsers. Use
#     this when you receive I/O errors because of the standard approach where
#     mod_ssl sends the close notify alert.
#   o ssl-accurate-shutdown:
#     This forces an accurate shutdown when the connection is closed, i.e. a
#     SSL close notify alert is send and mod_ssl waits for the close notify
#     alert of the client. This is 100% SSL/TLS standard compliant, but in
#     practice often causes hanging connections with brain-dead browsers. Use
#     this only for browsers where you know that their SSL implementation
#     works correctly.
#   Notice: Most problems of broken clients are also related to the HTTP
#   keep-alive facility, so you usually additionally want to disable
#   keep-alive for those clients, too. Use variable "nokeepalive" for this.
#   Similarly, one has to force some clients to use HTTP/1.0 to workaround
#   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
#   "force-response-1.0" for this.
BrowserMatch "MSIE [2-5]"          nokeepalive ssl-unclean-shutdown          downgrade-1.0 force-response-1.0

#   Per-Server Logging:
#   The home of a custom SSL log file. Use this when you want a
#   compact non-error SSL logfile on a virtual host basis.
CustomLog logs/ssl_request_log           "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

 ProxyPass "/ww" "http://127.0.0.1:8899/ww"
 ProxyPassReverse "/ww" "http://127.0.0.1:8899/ww"
 # ProxyPass "/" "http://127.0.0.1:16800/"
 # ProxyPassReverse "/" "http://127.0.0.1:16800/"

</VirtualHost>

  

原文地址:https://www.cnblogs.com/liangblog/p/11515532.html

时间: 2024-07-30 04:30:00

配置不同二级域名访问不同端口的应用的相关文章

Nginx 泛解析配置请求映射到多端口实现二级域名访问

由于想实现一个域名放置多个应用运行的目的,而不想通过域名后加端口号方式处理,这种方式处理记起来太麻烦,偷懒党简直不能忍,故而考虑了使用二级域名来处理多个应用同时运行.Google了一番资料并进行了尝试后,进行了总结. 文章开始之前先来理解一下二级域名的概念. 二级域名是指顶级域名之下的域名,在国际顶级域名下,它是指域名注册人的网上名称:在国家顶级域名下,它是表示注册企业类别的符号.我国在国际互联网络信息中心(Inter NIC) 正式注册并运行的顶级域名是CN,这也是我国的一级域名.在顶级域名之

万网二级域名访问nginx子目录

最近重新安装了小站(1wei.cc)的wordpress,打算使用二级域名blog.1wei.cc访问位于根目录下的wordpress(/wordpress,对应1wei.cc/wordpress).于是开始各种搜索了,各种问答.文章.博客反复研究实验,好不折腾,谁叫咱们半路出家,好多不懂.不得不说:天下文章一大抄,大多数人不会抄,抄了也不知道注明转载,好歹写错了可以说,这不是老子写的.找到好多人写(抄)的一模一样文章解决不了问题,不过我等开始看的时候还是不明所以得称赞高级.弄完了发现也挺简单的

Tomcat 加腾讯云 实现二级域名访问

搬家这个时间段不能用,从原网站https://blog.csdn.net/qq_36570464/article/details/86157394 截图过来的.也是自己写的. Tomcat 加腾讯云实现二级域名访问 腾讯云配置二级域名解析如图: 先添加一条记录: 如图中的123,然后在添加一条记录:其中:4为二级域名,5 为记录类型,必须为CNAME,记录值6处写上自己的一级域名. 云解析配置好后,然后再tomcat配置. tomcat中的server.xml 配置二级域名对应的项目 如图:添加

配置tomcat多域名访问

C:\Windows\System32\drivers\etc下的hosts文件改成:127.0.0.1 localhost 127.0.0.1 www.greenmood.net 127.0.0.1 www.cms4j.cn tomcat的server.xml文件 添加 <Host name="www.greenmood.net" appBase="greenmood" unpackWARs="true" autoDeploy="

菜鸟运维笔记:配置Apache二级域名及WWW访问

其实www访问也是二级域名的一种. 修改 http.conf文件 在该文件中添加 <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /www/html/api/ ServerName java.unclewang.org </VirtualHost> 如果你想配置你的域名的www访问,只需要把上述步骤中的java改为www.其路径指向网站根目录(DocumentRoot指向的路径)就行了. 小心403 注意所

windows+tomcat 7配置二级域名访问其他web程序

1.在域名管理中做好二级域名的解析 2.在tomcat的server.xml中增加如下: <Host name="wx.ai77.cn" debug="0" appBase="D:\\webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false&quo

CentOS7下搭建nginx反向代理服务器使得外网可以二级域名访问内网应用

创建nginx的本地yum源 [[email protected] ~]# yum list |grep nginx No package nginx available. [[email protected] ~]# //给跪了,什么鬼,怎么没有nginx的rpm?算了,直接自己手动配一个官网repo吧 [[email protected] ~]# //访问nginx官网,进入dowload页面,翻到底部的Pre-Build Package,选stable version ----------

菜鸟运维笔记:配置Apache二级域名及WWW訪问

事实上www訪问也能够理解为二级域名的一种. 域名 比方.com..org..edu..gov..info..net等等都是一级域名,或称顶级域名. 其详细格式是 *.顶级域名,比方csdn.net.而二级域名比方:bbs.csdn.net.blog.csdn.net.*.csdn.net的csdn.net就是二级域名. 实际上 http://csdn.net 都会重定向到 http://www.csdn.net 这个二级域 改动 http.conf文件 在该文件里配置"虚拟主机",即

在linux 服务器上用.htaccess文件实现二级域名访问子目录

实现子域名绑定网站子目录的方法有很多,比如可以用js跳转,可以用php实现,可以301跳转等,但最常用的应该是RewriteEngine方式了. 新建一个笔记本命名为.htaccess(在window操作系统之中无法这样直接命名),那么可以先随意命名上传到服务器之后再改名字为.hraccess. 在 .htaccess文件内容如下:(以yqltb.top域名为例) #开启url重写模式 RewriteEngine on #网站url伪静态匹配 DirectoryIndex index.php i