使用nginx作为前端的反向代理和作为后端的apache两个apache站点共享相同的index.html但是正确的root?有什么帮助吗?
Domain1和Domain3都是从它们的集合根加载但是对于共享相同index.html的东西。
有人能帮助我吗?
以下是我对nginx / conf.d / virtual.conf和httpd / conf / httpd.conf的配置
sudo nano /etc/nginx/conf.d/virtual.conf
server {
listen 80;
server_name domain1.com;
root /var/www/html/domain1.com/public_html;
return 301 https://domain1.com;
location ~ /\.ht {
deny all;
}
}
server {
listen 443 ssl;
root /var/www/html/domain1.com/public_html;
server_name domain1.com;
ssl on;
ssl_certificate /etc/pki/tls/certs/domain1.com.crt;
ssl_certificate_key /etc/pki/tls/private/domain1.com.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+EXP;
ssl_prefer_server_ciphers on;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass https://127.0.0.1:8080;
}
location ~ /\.ht {
deny all;
}
}
server {
listen 80;
server_name domain2.com;
root /var/www/html/domain2.com/public_html;
return 301 https://domain2.com;
location ~ /\.ht {
deny all;
}
}
server {
listen 443 ssl;
root /var/www/html/domain2.com/public_html;
server_name domain2.com;
ssl on;
ssl_certificate /etc/pki/tls/certs/domain2.com.crt;
ssl_certificate_key /etc/pki/tls/private/domain2.com.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+EXP;
ssl_prefer_server_ciphers on;
location / {
try_files $uri $uri/ /index.php;
}
}
server {
listen 80;
server_name domain3.com;
root /var/www/html/domain3.com/public_html;
return 301 https://domain3.com;
location ~ /\.ht {
deny all;
}
}
server {
listen 443 ssl;
root /var/www/html/domain3.com/public_html;
server_name domain3.com;
ssl on;
ssl_certificate /etc/pki/tls/certs/domain3.com.crt;
ssl_certificate_key /etc/pki/tls/private/domain3.com.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+EXP;
ssl_prefer_server_ciphers on;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass https://127.0.0.1:8080;
}
location ~ /\.ht {
deny all;
}
}
sudo nano /etc/httpd/conf/httpd.conf
#Listen 127.0.0.1:8080
NameVirtualHost 127.0.0.1:8080
<VirtualHost 127.0.0.1:8080>
DocumentRoot /var/www/html/domain1.com/public_html/
WSGIScriptAlias / /var/www/html/domain1.com/public_html/dir/dir/wsgi.py
WSGIDaemonProcess rambler.io python-path=/var/www/html/domain1.com/public_html/env/lib/pyth$
WSGIProcessGroup domain1.com
<Directory "/var/www/html/domain1.com/public_html/dir/dir">
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
ServerAlias domain1.com
ServerName domain1.com
ServerAdmin admin@domain1.com
SSLEngine On
SSLCertificateFile /etc/pki/tls/certs/domain1.com.crt
SSLCertificateKeyFile /etc/pki/tls/private/domain1.com.key
</VirtualHost>
<VirtualHost 127.0.0.1:8080>
DocumentRoot /var/www/html/domain3.com/public_html/
<Directory "/var/www/html/domain3.com/public_html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerName domain3.com
SSLEngine On
SSLCertificateFile /etc/pki/tls/certs/domain3.com.crt
SSLCertificateKeyFile /etc/pki/tls/private/domain3.com.key
</VirtualHost>
<IfModule security2_module>
Include crs/owasp-modsecurity-crs/modsecurity_crs_10_setup.conf
Include crs/owasp-modsecurity-crs/base_rules/*.conf
</IfModule>
sudo nano /etc/httpd/conf.d/ssl.conf
Listen 127.0.0.1:8080