How to redirect every vhost to https but without duplicating configuration. I have 4 websites on the same vps running Nginx and I want to redirect everything to https.
user3448600's questions
When I run nginx -V
I get something like this in the output.
--with-ld-opt='-lrt -ljemalloc -Wl,-z,relro' --with-cc-opt='-m64 -mtune=native -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-sign-compare -Wno-string-plus-int -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-c++11-extensions -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-pointer-sign -Wno-parentheses -Wno-enum-conversion'
What is this and how to know which values need to go here when compiling nginx from source code ?
Is Nginx official ngx_mod_http_geoip
compatible with GeoLite2 databases ? I can't get them working, so I assume they are not compatible ?
I compiled Nginx from source code and now I want to manage it via systemd like systemctl start,stop,restart,reload,enable nginx.service
. What I need to do to enable this ?
Is this correct way to set cron for renewal of Let's Encrypt cert in Apache2 ? I use Ubuntu 16.04.
@monthly letsencrypt renew && service apache2 reload
I have a domain - example.com
.
Below are my DNS records.
example.com A IP address
www.example.com A IP address
Here is my Apache virtual host configuration.
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /var/www/public_html/www.example.com
</VirtualHost>
Now when I type example.com
(without www
part) in my browser I get default Apache page not file from DocumentRoot
. When I add www
to my domain everything is OK.
Now the question is how to set this up so that both domains www.example.com
and example.com
serve the same file from document root? Should I handle this at DNS level or configure web server somehow? I am noob in all this so the question is probably stupid.