following this tutorial :
https://www.digitalocean.com/community/tutorials/how-to-redirect-www-to-non-www-with-nginx-on-centos-7
I modified my config file /etc/nginx/sites-available/domainName by adding on the last row :
return 301 $scheme://www.example.com$request_uri;
Then I launched :
sudo systemctl restart nginx
It works well. Then I tried to modify www.example.com by my domain name and I launched again ;
sudo systemctl restart nginx
but it doesn't work, I'm still redirecting to example.com
I checked the log files, sudo nginx -t etc and everything looks good.
Do you have an idea of the problem?
Thanks
Try clearing the DNS cache in your pc, browser, and router.
If you're using Windows to run a Linux server in a virtual box, you can run the ipconfig /displaydns command to see the time of cache to live.
Related
I have installed nginx as a load balancer on my Windows machine using nssm. Now, I want to reload the configuration file of nginx for that I used nginx -s reload command but it is not working. It gives errors as access denied and I don't want to restart nginx. Is there any way to reload the nginx configuration file in windows.
Try following:
nssm restart nginx
I have a Cpanel/WHM server with Nginx installed as reverse proxy (with default Nginx manager), so i tried to replace Nginx with Engintron.
I installed Engintron and uninstalled Nginx via Cpanel Nginx manager.
As a result i got website not working and Nginx couldn't start (status from WHM Engintron page), so i should reinstall Nginx?
I don't know if Engintron contains already Nginx or not
I tried to reinstall Nginx and website work again, but i don't know if Engintron is serving the website or Nginx
Engintron contains nginx installation within their script. So if you install only engintron, it will be default instead nginx in reverse proxy mode with apache.
You can check your nginx installed configuration file location by
sudo nginx -t
(it will show location of configuration file along with testing the same).
See if the nginx configuration file matches the engintron configuration file or not. If you are confused here also then run
$ sudo nginx -T
this will dump the output of configuration file which you may tally with Engintron config file.
Last option would be to uninstall both the nginx and make a clean installation of Engintron.
Try to run these commands first:
/usr/sbin/nginx -s stop
/usr/local/cpanel/scripts/restartsrv_nginx start
If the problem still exists, Uninstall Nginx and all Ruby packages from EasyApache via WHM and reinstall Nginx again.
After a restart of my VM instances my site is down. I checked the IP address, but it didn't change. Do you have any ideas about what is wrong and how to fix it?
I run WordPress (Bitnami) on a Debian-based OS. I use Cloudflare CDN. I understand that on stopping a VM it doesn't keep the settings. Can I restore them?
About your last error message
Syntax OK (98)Address already in use: AH00072: make_sock: could not
bind to address 0.0.0.0:80 no listening sockets available, shutting
down AH00015: Unable to open logs /opt/bitnami/apache2/scripts/ctl.sh
: httpd could not be started Monitored apache
I have found similar errors due to Nginx, it could happen if you have it installed and it is creating conflicts. make sure you remove it as follow:
sudo apt-get remove nginx nginx-common
sudo apt-get autoremove #to remove unneeded dependencies
Your environment doesn't loose configuration "settings", but rather the servers that use those configurations will terminate their processes when the VM shuts downs and will need to be restarted.
The problem is likely that you need to restart both your Apache web server (which starts the PHP runtime and proxies HTTP requests) and your MySQL server (which is your database)...
Restart Apache:
sudo service apache2 restart
Restart MySQL:
sudo service mysql restart
OR
sudo /etc/init.d/mysql restart
EDIT: It appears your Bitnami image has a different configuration...
Start All services: sudo /opt/bitnami/ctlscript.sh start
Restart Apache: sudo /opt/bitnami/ctlscript.sh restart apache
Restart MySQL: sudo /opt/bitnami/ctlscript.sh restart mysql
I recently started using vagrant and Virtualbox to run my Wordpress website. Today I ran into a problem. I was trying to import a theme and this happened.
413 Request Entity Too Large --- nginx/1.6.2 (Ubuntu).
I think that I know how to solve this, but for that i need to have access to the nginx.conf file. How do I access this where do I find it?
I' m using a mac.
you would need to login into the VM - you can do vagrant ssh to do so.
Once on the VM, you would need to edit your nginx.conf file as sudo (nginx.conf file is generally located in the directory /usr/local/nginx/conf, /etc/nginx, or /usr/local/etc/nginx on your VM depending how the installation was done) so sudo vi nginx.conf from the correct directory and you can make the change.
make sure to restart nginx after you made the change sudo /etc/init.d/nginx restart from the VM or even restart the VM if you make many changed vagrant reload from the host and you'll be ok
I have several subdomains running on nginx, and when i added next one, there was a problem with the same name of subdomain i removed.
I'm not shure that config were worked in the past. This is what i have found on serwer.
For now there is no possibility to restart nginx with virtual hosts, becouse it's failed.
config tests is ok,
without vh's it is restarting well,
nginx.conf test is ok,
logs are clear
nginx config is placed in project and /etc/nginx is pointing to that folder
I have add that exaple vh and it is crushing event with it.
What else can i check, what may cause such a problem?
I have found solution. Nginx could not start after stop, becouse ports 80 and 433 were busy by... nginx. Anyway
netstat -tulpn
shown what process are runing on particular ports.
I killed these processes with commands:
sudo fuser -k 80/tcp and fuser -k 433/tcp
and after that
sudo service nginx start
just worked.
Config files are fine, and test pass, logs where clear and nginx command show whats wrong