У меня есть план по управлению несколькими веб-сайтами на одном сервере, и в настоящее время я обрабатываю запрос http от nginx, а затем обрабатываю его в apache.
Вот какая у меня конфигурация для моего первого сайта:
# Force HTTP requests to HTTPS
server {
listen 80;
server_name myfirstwebsite.net;
return 301 https://myfirstwebsite.ne$request_uri;
}
server {
listen 443 ssl;
root /var/opt/httpd/ifdocs;
server_name myfirstwebsite.ne ;
# add Strict-Transport-Security to prevent man in the middle attacks
add_header Strict-Transport-Security "max-age=31536000" always;
ssl on;
ssl_certificate /etc/pki/tls/certs/cert.pem;
ssl_certificate_key /etc/pki/tls/certs/cert.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
access_log /var/log/nginx/iflogs/http/access.log;
error_log /var/log/nginx/iflogs/http/error.log;
###include rewrites/default.conf;
index index.php index.html index.htm;
# Make nginx serve static files instead of Apache
# NOTE this will cause issues with bandwidth accounting as files wont be logged
location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|htm|html|js|css)$ {
expires max;
}
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_pass https://127.0.0.1:4433;
}
# proxy the PHP scripts to Apache listening on <serverIP>:8080
location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_pass https://127.0.0.1:4433;
}
location ~ /\. {
deny all;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Теперь, мой вопрос, для второго, третьего веб-сайта и так далее, я подумываю изменить строку:
proxy_pass https://127.0.0.1:4433;
для
proxy_pass https://secondwebsite.net:4433;
но что я не хочу делать, так это то, что он выходит из интернета и ищет этот DNS, а затем возвращается на тот же сервер, но работает на том же сервере (вот почему у меня был localhost: 4433 на первом сайте), поэтому у меня не возникает проблем с задержкой.
Есть ли какое-то решение для этого?
Кроме того, я хочу знать, будут ли проблемы, если я буду обслуживать несколько серверов, использующих один и тот же порт (в данном случае 4433), или мне придется использовать разные порты для каждого веб-сайта.
Заранее спасибо.