R
R
Ruslan Absalyamov2018-04-22 15:03:48
Nginx
Ruslan Absalyamov, 2018-04-22 15:03:48

How to remove Failed to start error?

I am installing phpMyadmin with nginx bundled with apache2. And I had a problem in the sense that he began to give me this problem

sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2018-04-22 14:54:30 MSK; 3s ago
     Docs: man:nginx(8)
  Process: 9145 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exi
  Process: 10772 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILU
 Main PID: 27168 (code=exited, status=0/SUCCESS)

апр 22 14:54:30 debian systemd[1]: Starting A high performance web server and a reverse proxy server...
апр 22 14:54:30 debian nginx[10772]: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.co
апр 22 14:54:30 debian nginx[10772]: nginx: configuration file /etc/nginx/nginx.conf test failed
апр 22 14:54:30 debian systemd[1]: nginx.service: Control process exited, code=exited status=1
апр 22 14:54:30 debian systemd[1]: Failed to start A high performance web server and a reverse proxy server.
апр 22 14:54:30 debian systemd[1]: nginx.service: Unit entered failed state.
апр 22 14:54:30 debian systemd[1]: nginx.service: Failed with result 'exit-code'.

I took as a basis https://losst.ru/ustanovka-phpmyadmin-ubuntu-na-ng...
Here is my nginx
server{
  listen 80;
  server_name phpmyadmin;
  access_log /var/log/phpmyadmin.access.log;
  error_log /var/log/phpmyadmin.error_log;
  location ^~/phpmyadmin/{
    alias /usr/share/phpMyAdmin/;
    index index.php;
    location ~/phpmyadmin(/.*\.php){
      include fastcgi.conf;
      fastcgi_param SERVER_NAME localhost;
      fastcgi_param SERVER_FILENAME /usr/share/phpMyAdmin$1;
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
    }
  }
}

If anything I added in the /etc/apache2/ports.conf file
NameVirtualHost *:81
Listen 127.0.0.1:81

What should I do to make it work properly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2018-04-23
@rusline18

Return the standard /etc/nginx/nginx.conf Put
the file with your config in /etc/nginx/site-available/ and make a symbolic link (symlink) to it in /etc/nignx/sites-enabled/
The `server` block should do in the `http` block which is usually defined in the default `/etc/nginx/nginx.conf` file. In the same place, a rule is configured to read all files from the `/etc/nginx/sites-available/` folder, and it is precisely in these files that specific servers should already be determined.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question