早上好
我有我的node.js应用程序,它们使用/在/ home / user / project /下运行。
我用ssl证书安装了apache2,如果我检查http://domain.it,apache可以与证书一起正常工作。 这里是一些屏幕:http://prntscr.com/nleo6u
我在apache中进行的重定向有效,因为当我执行http://domain.it时,它会自动在https中进行重定向。 问题是当我尝试重定向到应以/ calendar开头的应用程序时 当我尝试转到http://domain.it/calendar(即重定向到我的node.js应用程序)时,出现错误:
Forbidden
You don't have permission to access /calendar/ on this server.
Apache/2.4.29 (Ubuntu) Server at calendar.domain.it Port 443
这是我的apache2.conf:
DefaultRuntimeDir ${APACHE_RUN_DIR}
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
# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
# Include list of ports to listen on
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www>
Options Indexes FollowSymLinks
AllowOverride All
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
# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf
我的000-default.conf
NameVirtualHost *:80
NameVirtualHost *:8080
<VirtualHost *:80 *:8080>
ServerName 10.160.10.101
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Redirect permanent / https://calendar.domain.it/
</VirtualHost>
default-ssl.conf
<VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/ssl/private/domain-chain.crt
SSLCertificateKeyFile /etc/ssl/private/p-key.key
SSLCertificateChainFile /etc/ssl/private/domain.crt
<Directory /var/www/html>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</Directory>
DocumentRoot /var/www/html
ServerName 10.160.10.101
ProxyPass /calendar http://localhost:8080/calendar
ProxyPassReverse /calendar http://localhost:8080/calendar
ProxyPass /survey http://localhost:8081/survey
ProxyPassReverse /survey http://localhost:8081/survey
ProxyPass /auth http://localhost:8081/auth
ProxyPassReverse /auth http://localhost:8081/auth
ProxyPass /old/calendar http://localhost:8080/old/calendar
ProxyPassReverse /old/calendar http://localhost:8080/old/calendar
ProxyPass /socket.io http://localhost:8080/socket.io
ProxyPassReverse /socket.io http://localhost:8080/socket.io
</VirtualHost>