首先,只是让您知道我对Web服务器有一点经验,因此,我的问题可能是新手。
我新建的网站遇到问题。我有一个用于其他网站的CentOS 7服务器,我想向该服务器添加一个具有不同URL的新网站。
据我了解,网站的配置位于/etc/httpd/conf.d中。
我为我的网站创建了一个新的.conf文件:
<VirtualHost *:443>
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
#SSLCertificateFile /etc/pki/tls/certs/localhost.crt
#SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
#SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.trust.crt
SSLCertificateFile /etc/letsencrypt/live/******/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/******/privkey.pem
#SSLCACertificateFile /etc/letsencrypt/live/******/chain.pem
SSLCACertificateFile /etc/letsencrypt/live/******/fullchain.pem
ServerName mywebsite.com
DocumentRoot /var/www/myproject
ErrorLog /var/log/httpd/ssl-mywebsite.com-error_log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel error
CustomLog /var/log/httpd/ssl-mywebsite.com-access_log combined
<Directory /var/www/myproject>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName mywebsite.com
DocumentRoot /var/www/myproject
<Directory /var/www/myproject>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted …
Run Code Online (Sandbox Code Playgroud) 我想要做的是采取以下措施:
http://localhost:10000
http://localhost:11000
http://localhost:12000
Run Code Online (Sandbox Code Playgroud)
并分别路由如下:
http://my-app (this is port 10000 traffic)
http://my-app/app (this is port 11000 traffic)
http://my-app/blog (this is port 12000 traffic)
Run Code Online (Sandbox Code Playgroud)
这是我的conf.d文件-
<VirtualHost *:80>
ServerName my-app.domain.com
ServerAlias my-app
Redirect / https://my-app.domain.com/
</VirtualHost>
<VirtualHost *:443>
ServerName my-app.domain.com
ServerAlias my-app
Include ssl/default/ssl.cfg
RewriteEngine On
ProxyRequests Off
ProxyPreserveHost On
RemoteIPHeader X-Forwarded-For
RequestHeader set X-FORWARDED-SSL on
RequestHeader set X-FORWARDED_PROTO https
ProxyTimeout 900
TimeOut 900
RewriteRule ^$ / [R]
ProxyPass / http://localhost:10000/
ProxyPassReverse / http://localhost:10000/
RewriteRule ^/app/(.*) http://localhost:11000/$1 [P,L]
ProxyPassReverse /app/ http://localhost:11000
</VirtualHost> …
Run Code Online (Sandbox Code Playgroud)