on my server (os : ubuntu 16) I have update my nginx configuration file by mastake then save and close the file , Is there away to get previous file before changes , hint: I havn't restart nginx on my server yet . I need help immediately
Depends on your version of nginx.
See here: dump conf from running nginx process
in any case, you can dump the original nginx config-file with gdb.
Also, if you edited the file with a gnome software, there's a chance the config file backup is still there, under "filename~" (note the tilde at the end).
Or you can get the old inode from /proc/pid/fd (Linux keeps old used files in memory, until all processes using them exited - since nginx still runs, the inode is still there - inode or index node is the id of the file on the file system).
Related
My VPS Server (CPanel) got full so I decided to delete some files, namely the following
ssh root#server_ip_address
MB(space) File Location
2583 /home/someuser/tmp/analog/cache <-------------1
1883 /home/someuser/tmp/analog/cache.out <-------------2
1061 /usr/tmpDSK <------------3
When I deleted the first two files it did free up some 4GB of space the disk was showing 85% occupied. Then I deleted the tmpDSK file (1.06GB) but it had no impact on disk size. After some half, an hour or so, our server crashed and it won't serve pages. It is up though and I can ping it but pages are not served.
What I noticed right away after I deleted tmpDSK, the user/local/ folder was missing (got deleted by mistake?) which contains Apache, Perl etc and hence the reason web sites are not being served.
Just now I logged in to the server via SSH and I got the following messages
-bash: /usr/local/cpanel/3rdparty/bin/perl: No such file or directory
-bash: /usr/local/cpanel/3rdparty/bin/perl: No such file or directory
-bash: /usr/local/cpanel/3rdparty/bin/perl: No such file or directory
I am wondering, what possibly happened. Can I restore things myself, we do have a backup on the external drive? Is there a way deleted files can be restored? I deleted them from sftp, one by one. There is already a ticket opened with the host provider, but I want to understand things myself better and see if I can restore it somehow. Note none of the Linux commands works on SSH, like ls etc. Also tmpDSK is supposed to be cPanel related where it store sessions, temporary files
Thanks
Answering myself
After more than 24 hours of troubleshooting with the host, and then personally researching we found the issue was very trivial.
We accidentally moved the contents of /usr/local/ folder to /usr/include which cause all the problems. Simply moving it back fixed the problem.
The content was moved unexpectedly when working with server with FTP (sftp). It likely had nothing to do with the three deleted files that I had deleted.
I have a Linux NAS server (WD MyCloud Ex41) that I want to create an aditional apache2 vhost on it. Now the problem every time I create a new vhost file and when i reboot the server my vhost that i created will lost and back to its original config. With that said, I think the OS has performing the file integrity checking during boot or so. Is there a way to disable this, or maybe create a config file during boot at runs/execute the new config file it after the integrity checking? or maybe on bash script? Please advise. Thanks
I am running Open Source Chef 11 Server and a dozen or so Linux and SmartOs servers running chef-client. At one point I created a file on one of my linux servers with the filename of "down" in a specific directory and that prevented the chef-client from running, even after reboot. I have since deleted this file and I cannot remember which directory I had put that file in. I can no longer find any documentation that this existed or works. Did I imagine this?
I realize the point of Chef is to have chef-client running at all times but sometimes it is useful to disable the chef-client while experimenting with the server configuration.
I believe this "down" file might be related to runit.
I think I found it.
If I create the file in /etc/sv/chef-client
# touch /etc/sv/chef-client/down
then run
# sv status chef-client
I get back
down: chef-client: 85480s; run: log: (pid 8000) 93131s
If I remove the down file I get back
down: chef-client: 85539s, normally up; run: log: (pid 8000) 93190s
I have an Ubuntu VirtualBox that's setup by Vagrant. Its running NGINX to serve some static files and a Django app.
I have the source folder synced via vagrant to the repo in my host (windows). I can make changes to a Javascript file in Windows and verify that the changes are made to my file in the VM by SSH'ing in and opening the file in nano.
However, when I make the changes remotely, NGINX seems to serve up the unchanged version with "illegal" characters added to the end (which really freaks out browsers). I get the same file when I CURL localhost while ssh'd into the vm. EDIT It actually does the same thing when I edit the file via SSH
I can reload the vm via vagrant (which re-syncs the folders) and it works fine until the next remote change.
Restarting nginx and gunicorn doesn't help.
Does vagrant lock the files so that nginx has to rely on a cache? What might be going on here?
Thanks!
Apparently my coworker has better Google-foo than I.
This is apparently a known issue with virtualbox and nginx that has to do with the nginx's sendfile. You can simply add "sendfile off;" in either your server or location blocks in the nginx config. Here's a blogpost about it: nginx virtualbox static files
I have set up ubuntu server on an old pc with webmin as well. I am not sure what was going on but i restarted the server and when it boots it now get this when Apache tries to start.
* Starting web server apache2
apache2: Syntax error on line 237 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/000-default: No such file or directory
Action 'start' failed.
The Apache error log may have more information.
I have checked this file on this line and it looks like this:
# Include the virtual host configurations:
Include sites-enabled/
I have removed Apache and re installed it but not sure why it still fails.
As also answered by Qben, the issue was an invalid symlink in the sites-enabled folder. Removing the broken symlink and adding a valid one will fix the issue.
You do not have a default site enabled:
/etc/apache2/sites-enabled/000-default: No such file or directory
site-enabled should contain symlinks to files in site-available and I guess your 000-default symlink does not link to a real file in site-available.
I guess this Ubuntu guide might be of interest for you.
One of the reason may be that you might have some site that is not enabled.To check that
Go to /etc/apache2/sites-enabled
Out of many/some [sitename].conf files , one/some may be crossed
Delete those found crossed
Restart apache server
sudo service apache2 restart.
Hope this has helped you , but may be some other reason too. Thank you.