Answer the question
In order to leave comments, you need to log in
How to set up human vhosts in nginx?
Hello.
Made 3 hosts. Nginx redirects everything to 127.0.0.1 and doesn't open them. Neither by ip nor by name.
configs:
1st
server {
listen 443 ssl;
server_name work.dev www.work.dev;
root /Users/Greg/WebServer/work.dev/www;
index index.php;
access_log /Users/Greg/WebServer/work.dev/logs/access.log;
error_log /Users/Greg/WebServer/work.dev/logs/error.log;
ssl on;
ssl_certificate ssl/work.dev.crt;
ssl_certificate_key ssl/work.dev.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
autoindex on;
}
location ~ /\. { deny all; access_log off; log_not_found off; }
location ~* ^.+\.(bmp|jpg|jpeg|gif|ico|png|css|doc|txt|js|zip|iso|tgz|gz|rar|bz2|7z|xls|exe|pdf|ppt|tar|wav|avi|rtf|mp3|mp4|mov|mpeg|mpg) {
expires 5d;
limit_rate 100M;
if ($http_user_agent ~ FDM|Download) {
limit_rate 50M;
}
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
gzip on;
}
include /usr/local/etc/nginx/conf.d/php-fpm;
}
server {
listen 100;
server_name test.dev;
root /Users/Greg/WebServer/test.dev/web;
index index.php index.html index.php;
access_log /Users/Greg/WebServer/test.dev/logs/access.log;
error_log /Users/Greg/WebServer/test.dev/logs/error.log;
ssl on;
ssl_certificate ssl/test.dev.crt;
ssl_certificate_key ssl/test.dev.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
autoindex on;
}
location ~ /\. { deny all; access_log off; log_not_found off; }
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
include /usr/local/etc/nginx/conf.d/php-fpm;
}
server {
listen 82;
server_name hiwork.dev www.hiwork.dev;
root /Users/Greg/WebServer/hiwork.dev/www;
index index.php;
access_log /Users/Greg/WebServer/hiwork.dev/logs/access.log;
error_log /Users/Greg/WebServer/hiwork.dev/logs/error.log;
ssl on;
ssl_certificate ssl/hiwork.dev.crt;
ssl_certificate_key ssl/hiwork.dev.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
autoindex on;
}
location ~ /\. { deny all; access_log off; log_not_found off; }
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
include /usr/local/etc/nginx/conf.d/php-fpm;
}
Answer the question
In order to leave comments, you need to log in
Despite the general delusional nature of the config, there is nothing to advise here, let's start with a simple one:
1) ssl certificates are all generated?
2) Does it listen to anything on port 9000 of the localhost? Must listen to php-fpm
3) For ports 82 and 100, it is not specified that this is ssl, although there is an indication of ssl inside the config?
And it may even open if you open it like this:
https://127.0.0.1
127.0.0.1:82
127.0.0.1:100
But it looks like an absolutely thoughtless copy-paste of the config, without any understanding of the materiel.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question