I am using the latest version of goaccess (0.6) to analyze nginx log. The program seems to be parsing the file OK, since I am getting the host IPs, statistics etc. But the geoip is either not working, or I am not able to figure out how to get to the details page for hosts. As you can see, it is linking geoip
ldd -r /usr/local/bin/goaccess
..
libGeoIP.so.1 => /usr/lib/libGeoIP.so.1 (0x00007fae4ea58000)
...
The dat file is also in place -
ls -al /usr/share/GeoIP/GeoIP.dat
-rw-r--r-- 1 root root 1664511 Jan 3 2012 /usr/share/GeoIP/GeoIP.dat
Related
I have a Synology Diskstation DS216se running DSM 6.2.3-25426. I've installed MariaDB 10, Web Station, PHP 7.2, and myPhpAdmin, but when I open it at http://diskstation/phpMyAdmin/ I get this error message
"Sorry, the page you are looking for is not found."
I'm using an nginx server in Web Station, and the error log at /var/log/nginx/error.log contains multiple entries like the following
*621 open() "/var/services/web/phpMyAdmin/js/vendor/jquery/jquery.debounce-1.0.5.js" failed (13: Permission denied)
The file, and all other files with permission denied entries in the logs, exist in the /var/services/web/phpMyAdmin/ directory - what permissions need to be granted to the directory for this to succeed?
I hit this as well. I managed to recover, but it effectively amounts to hard clearing any evidence of prior installs of Web Station, PHP 7.2, phpMyAdmin, and any other web related services. Then manually ripping out some bad directories with broken symlinks/permissions.
My hypothesis is that I tried to install adminer prior to this and - having not done any set up for Web Station et. al. - it put the filesystem in a bad state.
I am not willing to try installing adminer again to test this hypothesis.
What I did to fix this:
Backup what you need (e.g., any personal web site).
SSH into your diskstation. Please be aware of what you are doing and keep in mind the big picture. Don't go deleting random things.
Uninstall Web Station, PHP 7.2, Apache, phpMyAdmin, etc. Anything that Web Station would ultimately be inclined to read and serve up.
Verify that /var/services/web doesn't contain anything you care about, and delete it (sudo rm -rf /var/services/web).
Verify that /volume1/web doesn't contain anything you care about, and delete everything inside it (sudo rm -rf /var/services/web). You may need to chmod permissions for this - I ended up leaving the web directory itself intact, but nothing inside.
Reboot. Mount any encrypted disks, etc.
Check that /var/services/web now shows it is symlinked to /volume1/web, e.g. sudo readlink -e /var/services/web.
Also check permissions for /volume1/web, e.g. ls -al /volume1. It should be owned by root:root and have permissive (777) bits.
Install Web Station, PHP 7.2, and phpMyAdmin in that order.
After this, I could open phpMyAdmin and be served its log in screen.
Debugging notes:
For me, when I SSH in I see in the logs similar issues:
2020/12/17 10:36:35 [error] 32658#32658: *1028 "/var/services/web/phpMyAdmin/index.php" is forbidden (13: Permission denied),
ps says that the nginx workers run as the http user (uid=1023(http) gid=1023(http) groups=1023(http)).
The directory /var/services/web/ appears to be owned by root, both group and user:
# ls -al /var/services/web/
total 424
drwxr-xr-x 3 root root 4096 Dec 17 10:29 .
drwxr-xr-x 3 root root 4096 Dec 17 10:22 ..
-rw-r--r-- 1 root root 27959 Apr 13 2016 adminer.css
-rw-r--r-- 1 root root 82 Apr 13 2016 .htaccess
-rw-r--r-- 1 root root 387223 Apr 13 2016 index.php
drwxr-xr-x 10 root root 4096 Dec 17 10:29 phpMyAdmin
It's not clear to me how Web Station's nginx is intended to work at all given the mismatch - perhaps some set of actions I took prior caused it to decide to install with bad ownership.
I decided to leave everything owned by root, but changed group permissions so that http can access:
# chown -R root:http /var/services/web/
# chmod -R 775 /var/services/web/
This got past the initial error, but revealed a new one:
"/usr/syno/synoman/phpMyAdmin/index.cgi" is not found (2: No such file or directory)
Indeed, there was no trace of phpMyAdmin anywhere in that directory. Evidence of a bad install.
I decided to uninstall anything web related: phpMyAdmin, PHP 7, Apache (happened to be installed), nginx, and Web Station. Once I did, I still had two files in /var/services/web: adminer.css index.php.
I had tried adminer prior to this. In /var/services, there were symlinks to specific volume locations, e.g.:
# ls -al /var/services/
total 12
drwxr-xr-x 3 root root 4096 Dec 17 10:22 .
drwxr-xr-x 17 root root 4096 Dec 17 10:21 ..
lrwxrwxrwx 1 root root 18 Jan 20 2020 download -> /volume1/#download
lrwxrwxrwx+ 1 root root 14 Dec 17 10:22 homes -> /volume1/homes
lrwxrwxrwx 1 root root 24 Jan 20 2020 pgsql -> /volume1/#database/pgsql
lrwxrwxrwx 1 root root 13 Dec 17 10:22 tmp -> /volume1/#tmp
lrwxrwxrwx 1 root root 13 Dec 17 10:22 web
Interestingly, web was not symlinked. I fully deleted /var/services/web.
Looking over at /volume1, I do see a /volume1/web, again fully owned by root but with extremely constrained permission:
d---------+ 1 root root 52 Dec 17 10:14 web
There are only a few things in here, which look related to a blank install of Web Station. I fully deleted everything within /volume1/web, but left it as is. With everything maximally cleaned I rebooted.
Upon boot, /var/services/web was now symlinked to /volume1/web, which now also had useful permission bits (777), and owned by root:root. Maybe this was done by some boot recover process, who knows. (I still have nothing web related installed at this point.)
I installed Web Station, then PHP 7.2, then phpMyAdmin.
I had the same issue when accessing my server via
<name>.local/phpMyAdmin/
It worked when I accessed it via
<local ip>/phpMyAdmin/
I am running a Wordpress Install (OpenLiteSpeed) in a Google Cloud Compute VM running Ubuntu
I can access the main folder of Wordpress via web browser by typing in the static IP - but I cannot access individual files and/or folders on my machine via web browser.
I would like to share files by posting links to files located in on the VM, Wordpress install folder.
How can I do that?
My permissions of the folder inside the worpress install are:
thisisme#wordpress-vm:~$ ls -la /var/www/html/myFolder
total 432
drwxrwxrwx 2 thisisalsome thisisalsome 4096 Mar 21 09:39 .
drwxr-xr-x 6 thisisalsome users 4096 Mar 21 09:59 ..
-rwxrwxrwx 1 thisisalsome thisisalsome 433790 Mar 21 09:02 pic.jpg
You need to move the /var/www/myFolder folder into the /var/www/html folder and access files by hostname/myFolder/myFile.zip or to configure the webserver to serve your myFolder under a different dns.
That is probably because your default webserver's configuration only serves files from the /var/www/html folder.
#Octavian
I did use the same capitalisation - but i just realised I made the mistake of using the wrong access path - i was typing
xx.xx.xxx.xxx/html/myFolder/pic.jpg
but I should have used
xx.xx.xxx.xxx/myFolder/pic.jpg
AND NOW IT WORKS !! Thanks for pointing that out for me! I did not know UNIX servers are case sensitive!! :) Thanks For Your Help!
I assume I simply have to insert an entry into an nginx.conf file to resolve the error that is plaguing me (see below), but so far I haven’t had any luck figuring out the syntax. Any help would be appreciated.
I want to run nginx as a regular user while having installed it using homebrew as a user with administrative privileges. nginx is trying to write to the error.log file at /usr/local/var/log/nginx/error.log, which it cannot because my regular user lacks write privilege there.
Another wrinkle is coming from the fact that there are two nginx.conf files, a global and a local, and as far as I can tell they are both being read. They are in the default homebrew location /usr/local/etc/nginx/nginx.conf and my local project directory $BASE_DIR/nginx.conf.
Here is the error that is generated as nginx attempts to start up:
[WARN] No ENV file found
10:08:18 PM web.1 | DOCUMENT_ROOT changed to 'public/'
10:08:18 PM web.1 | Using Nginx server-level configuration include 'nginx.conf'
10:08:18 PM web.1 | 4 processes at 128MB memory limit.
10:08:18 PM web.1 | Starting php-fpm...
10:08:20 PM web.1 | Starting nginx...
10:08:20 PM web.1 | Application ready for connections on port 5000.
10:08:20 PM web.1 | nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)
10:08:20 PM web.1 | 2017/03/04 22:08:20 [emerg] 19557#0: "http" directive is duplicate in /usr/local/etc/nginx/nginx.conf:17
10:08:20 PM web.1 | Process exited unexpectedly: nginx
10:08:20 PM web.1 | Going down, terminating child processes...
[DONE] Killing all processes with signal null
10:08:20 PM web.1 Exited with exit code 1
Any help figuring out how to get nginx up and running so I can back to the development side of this project will be much appreciated.
The whole problem stems from trying to run nginx as my ordinary user self despite the fact that nginx was installed by my user self with administrative privileges. I was able to resolve both the errors shown here with the following commands executed as a user with administrative privileges:
sudo chmod a+w /usr/local/var/log/nginx/*.log
sudo chmod a+w /usr/local/var
sudo chmod a+w /usr/local/var/run
Note that the /usr/local/var directory appears to have been created by homebrew upon installing nginx and this machine is my laptop so I can’t see any reason not to open it up. You might have greater security concerns in other scenarios.
I admit that when I wrote this question I thought it was about moving the error.log file to another directory. Now I see that that is not a full solution, so instead the solution I present here is about giving ordinary users write privileges in the necessary directories.
The reason I changed my mind is that nginx can (and in this case does) generate errors before (or while) reading the nginx.conf files and needs to be able to report those errors to a log file. Modifying the nginx.conf file was never going to solve my problem. What woke me up to this issue was reading this post: How to turn off or specify the nginx error log location?
Did you try to set the log path to a custom location by editing nginx.conf?
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
Change path to somewhere use has write privileges.
Atom is able to open a project, and to show the whole tree of the project on the left side, a really nice feature.
Now I'm using SSH on Host OS to access a Guest OS (say Red Hat Enterprise Linux, RHEL) on Virtualbox, is there a way of Atom located in Host OS to open a project located on RHEL?
Well yes there is!
You just need to configure sshfs, optionally with autofs. Then you can access the files as if they are stored locally. I've used this with Atom and it works seamlessly.
Instructions for Ubuntu
Install sshfs
$ sudo apt-get install sshfs
Mount the remote directory on a local mountpoint
$ sshfs [user#]host:[dir] mountpoint
Combining it with autofs
The following link has instructions for a setup using autofs.
Note: This requires you to setup SSH for the root user.
http://www.mccambridge.org/blog/2007/05/totally-seamless-sshfs-under-linux-using-fuse-and-autofs/
Additionally to that post, I've added some tricks for an even more seamless experience.
Enhance performance
I've noticed a significant performance boost by adding this SSH config to /root/.ssh/config:
Ciphers arcfour
Compression no
Note: This does make the connection less secure.
Make it appear as a disk
If you set the mount point to a directory in /media, the mount point will show up as a disk in your file browser. For example /media/sshfs.
I would recommend the Remote sync plugin for this. I have a python environment set up on a linux box and i connect to it from my PC.
It allows me to upload changes automatically when i save a file and also define files to be monitored for changes.
Not 100% what you're looking for, but there's the Remote-Edit package: https://atom.io/packages/remote-edit
This will allow you to define the connection parameters for the server, and will then allow you to browse and edit the files found on the server.
Complement to Remco's sshfs answer above:
If you use different users in the client and server hosts, consider using the 'idmap' option of sshfs.
I use different users in my working host and in the development or testing VMs.
Example:
using option '-o idmap=user' will automatically translate UID/GID of the remote host to the UID/GID of the connecting user in the local host
Files owned by remote user (devuser) in remote host (devhost1) will appear as belonging to the connecting user (locuser) in local host (clienthost)
locuser#clienthost:~$ sshfs devuser#devhost1:/var/www ~/dev/www -o idmap=user
locuser#clienthost:~$ ls -lR ~/dev/www
(...)
-rw-rw-r-- 1 locuser locuser 269 abr 1 11:37 index.html
-rw-rw-r-- 1 locuser locuser 249 abr 3 03:59 page1.html
-rw-rw-r-- 1 locuser locuser 1118 abr 2 15:07 page2.html
-rw-rw-r-- 1 locuser locuser 847 abr 3 03:20 page3.html
(...)
The mapping can also be made explicit (userx <-> usery). For more details see man sshfs
I am writing this answer because none of the other answers worked for me.
Mounting as a directory & browsing with atom (#Remco Haszing answer) was a brilliant one.
but in my case, atom wants to index all of the remote project & its a heavy one. and it gets not responding.
using remote-sync package was good when you working locally then want to upload the files to server.
Actually the remote-edit is the package meant to do this job. (editing files remotely on ssh)
the problem with this is, it has been abandon.
These help me as its replacements:
https://atom.io/packages/remote-edit-ni
https://atom.io/packages/remote-editor
I have just installed nginx on Ubuntu 14.04 using the command
sudo apt-get install nginx
Now, when I open my browser and type in the address localhost then I am correctly shown the "Welcome to nginx" page. Also, I checked the config file located in /etc/nginx/nginx.conf and found the following log settings:
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
However, when I check these two files, both are empty. I have opened the localhost page multiple times but still the log files are empty. What might be wrong with my setup ?
I had the same issue after reinstalling nginx to newer version. Seems like log files ownership changed and new nginx couldn't save anything there.
Removing log files and reloading nginx worked for me:
$ sudo rm -f /var/log/nginx/*
$ sudo nginx -s reload
It looks like by default they are set to go to stdout and stderr.
lrwxrwxrwx 1 root root 11 Apr 27 2016 access.log -> /dev/stdout
lrwxrwxrwx 1 root root 11 Apr 27 2016 error.log -> /dev/stderr
So you can remove the symlinks and should be fine.
rm -f /var/log/nginx/*
For all of those whose, like me, came here to figure out why the logs file are empty, and did not realise that you might actually be inside a docker container like one of the comments on another answer suggests, just open a new shell and tail the logs with
docker logs {your-container-id-here} -f
By default Nginx image output the logs access/error to stdout/stderr.
lrwxrwxrwx 1 root root 11 Apr 27 2016 access.log -> /dev/stdout
lrwxrwxrwx 1 root root 11 Apr 27 2016 error.log -> /dev/stderr
We can also check the same by visit this Nginx Dockerfile, look for the comment # forward request and error logs to docker log collector
Now Use the below configuration in order to view the files.
I have changed file name
*error.log = error.logs
access.log = access.logs*
error_log /var/log/nginx/error.logs notice;
access_log /var/log/nginx/access.logs;
Your answer is here
Step1: Open the rsyslog config file
#vi /etc/rsyslog.conf
Step2: Add the following line before the line $IncludeConfig /etc/rsyslog.d/*.conf
$ModLoad imfile
Step3: Create a new file for nginx rsyslog configuration
#vi /etc/rsyslog.d/nginx.conf
Step4: Update the following lines.
# error log
$InputFileName /var/log/nginx/error.log
$InputFileTag nginx:
$InputFileStateFile stat-nginx-error
$InputFileSeverity error
$InputFileFacility local6
$InputFilePollInterval 1
$InputRunFileMonitor
# access log
$InputFileName /var/log/nginx/access.log
$InputFileTag nginx:
$InputFileStateFile stat-nginx-access
$InputFileSeverity notice
$InputFileFacility local6
$InputFilePollInterval 1
$InputRunFileMonitor
Step5: Restart rsyslog service
#service rsyslog restart