Unable to reload Nginx context - nginx

I am newbie to Nginx and adding upstream configuration dynamically through a java program, after that I am trying to reload the context and getting the below error. I tried to reload context on command prompt even and getting sane error over there. I opened the command prompt using admin rights.
C:\nginx-1.16.1>nginx -s reload
nginx: [error] OpenEvent("Global\ngx_reload_6512") failed (5: Access is denied)
Please share if some one have already come across this problem and found some solution.
Greatly appreciated.

Related

unix:///var/run/supervisor.sock refused connection during restarting supervisor

When I created a new .conf file inside /etc/supervisor/conf.d/ and tried to start this program it was showing some errors (fatal error) and restarting frequently by itself. Then I ran the command sudo service supervisor restart but now the supervisor also stopped and couldn't be restarted it. During solving my error the nginx server also got stuck also.
After spending a vast time I recovered it Alhamdulillah and writing the solution in the answer section.
Don't trust the solution entirely for your problem. Your problem may belong to another issues as well.
Sometime Supervisor can show the below horrible error when you restart the
service (by the command sudo service supervisor restart):
unix:///var/run/supervisor.sock refused connection
Try to diagnosis the problem with the command supervisord. You can also run journalctl -xe.
Problems and Solutions:
When you write a new .conf file to inside the /etc/supervisor/conf.d directory which contains some statements that are generating error.
Like, you write some statements that will run a script. That script contains some statements that runsGunicorn to deploy a python web apps. In the script you wrote a statement to bind an unix socket. But the mentioned directory where the unix socket will be created doesn't give permission to create the .sock file there. This can lead the permission error.
The demo gunicorn command is below:
SOCKFILE = /home/shamim/python_project/another_directroy/gunicorn.sock
gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--bind=unix:$SOCKFILE
If the another_directory doesn't give the permission to create a .sock file inside it then an error can be occurred. So give it enough permission to create something here from outside. Or, Bind IP and port instead unix socket (like 127.0.0.1:ANY_PORT). Be sure first the port is not used by another application.
Sometimes the error can be occurred if any directory path is used inside .conf file but actually that directory doesn't exist at all.
Now run the command supervisord.
If the error persists after fixing the above issues and now shows a error like -
another program is already listening on a port that one of our HTTP servers is configured to use
then run the below command to fix this issue:
sudo unlink /var/run/supervisor.sock
If the command above does not work you should check run unlink the file at /tmp/supervisor.sock
Keep in mind that the nginx server can also show some errors and fail to
restart (or start) if any .conf file contains some statement where a socket
is used but actually the socket file doesn't exist or doesn't have enough permission to be executed.
Example: If you write the below code in any nginx file config:
upstream surveyapp_payment_stripe {
server unix:/home/shamim/python_project/another_directroy/gunicorn.sock fail_timeout=0 weight=5 max_fails=3;
}
If the above socket doesn't exist or not have enough permission then some error may be occurred.
Nginx can also show error if any directory path is used here but not exists at all. To run nginx at this time quickly just delete the .conf file or edit it's extension (make another another extension type other than .conf).
Hopefully this explanation will help someone in future.

Update .py file on nginx, gunicorn, supervisor

I don't know why this is so difficult, but everytime I update a file in my flask application I have to restart gunicorn so that the file updates on the server. I am mostly a front-end developer and don't play with servers enough to remember these things, and I have to spend hours google searching various phrases to find the right commands. This time I can't seam to find anything, and the file I created to save these things has conveniently disappeared.
My server:
Ubuntu 18.04
nginx
gunicorn
supervisor
I am updating a .py file. I placed the updated version on the server using ftp. I'm logged into the server, using ssh, through a git bash shell. sudo systemctl gunicorn restart give me the error Failed to restart gunicorn.service: Unit gunicorn.service not found.. Rereading and restarting supervisor does not do the trick, and neither does restarting nginx. Is there not a simple command to apply updates? I'm use to using servers on general hosting sites, and updating a file via ftp just works. I was really enjoying learning flask up until this point, but now I regret it. I keep thinking that there has to be some kind of simple trick to make such a simple thing go smoothly, but I'm at the end of my rope trying to figure this out. Any suggestions?
I finally found it.
sudo supervisorctl stop app_name
sudo supervisorctl start app_name

RStudio Server returns "Cannot read property 'error' of null"

When I try to go into RStudio Server (1.0.44), I get the following error in the browser:
RStudio Initialization Error
(TypeError) : Cannot read property 'error' of null
This happens before logging in - it has the rotating clock thing for a minute and goes straight into that.
I have tried all sorts of remedies, including restarting the server, rebooting, uninstalling and reinstalling RStudio server, changing the port settings, deleting the .RStudio folder in my home directory, etc. I checked the system log and that didn't seem to have anything relevant. There were a few errors, of course, but nothing after I got the error.
Also, R works fine from the terminal and I have the latest version of both R and RStudio.
Anyone have any ideas?
You probably tried to restart rstudio already, but this is not enough.Follow these steps:
Do a ps -u user where user is one of the user whose session is returning the error in the browser
[root]# ps -u username
PID TTY TIME CMD
19445 ? 00:00:18 rsession
kill the rsession related to it using it's PID.
[root]# kill 19445
start rstudio using sudo rstudio-server start.
Go to the folder contained within the project you were working with last and delete the ProjectName.Rproj file.
restart rstudio using sudo rstudio-server restart
P.S:
If after second step, problem remains, you could remove the .Rproj file using command line: rm directory/of/Rproj/File/ProjectName.Rproj
rm -r .rstudio
sudo rstudio-server suspend-all
worked for me.
I first also moved .RData to a separate folder and upgraded the rstudio server. However, still the problem remained.
I went through a lot of trouble and have finally managed to get it to work again. What ultimately seems to have worked is upgrading to the newest version (1.0.136), deleting all .Rhistory and .Rproj.user files, stopping the server and deleting the .rstudio file in my user profile, and then restarting. I wish I had more info on why it stopped and what fixed it exactly, but at least it's working again. Note that when I upgraded--and before deleting the .rstudio folder (which I had already done a few times), the error message changed to:
Status code 500 returned
So that seems to be the same error--maybe this will help someone else to resolve this problem.

cant start mongodb strange behavior permission denied as root

Im running as root on a smartos64 machine.
My database is at /data/db
Mongod is at /mongo/bin/mongod
I get a 'permission denied' error with no further details when running either
- run ./mongo/bin/mongod or
- sudo ./mongo/bin/mongod
I tried changing permissions with chown on /data/db, but I still get this behaviour. How would I start mongo?
What build of Mongo did you download? I believe SmartOS64 is a derivative of Solaris, so I would try a Solaris build from the Mongo download site. If that doesn't work, you may want to build it from source.

Elgg Installation Problems

I am running Apache2.2, with PHP5 and mod_rewrite enabled on a VPS running Ubuntu Hardy. And I am trying to install Elgg1.5. I uploaded it to /var/www, and changed the appropriate permissions.
When I hit the url, it brings me to the installation page where I provide the database info. When I submit the page, I get the following error in my access.log
"Cannot modify header information - headers already sent by (output started at /var/www/engine/lib/._access.php:1)" in file /var/www/engine/start.php (line 182)
I don't see any problems within the .htaccess and engine/settings.php file it creates, and no whitespaces before and after the php tag. Since I haven't hand-touched any files, I have no clue whats causing the error. Anyone's played with Elgg1.5 ?
Problem solved. It was some corrupt file.

Resources