After apache2, you need to go to the nginx + apache2 combination. For security and performance purposes.

After studying the documentation we managed to do:

  1. In the apache2 config, configure it to listen on port 81.
  2. In the nginx config, configure it on port 80.

Now when I go to the site, I see the Nginx welcome window, but I could not start the site.

It even turned out to see the Prestashop installation page (the distribution was preloaded) and go through all the steps, but after successful installation I see only the white page.

How can this be properly set up or read more about it?


I did everything as you said, but the nginx welcome window was not lost.
The fully expanded site is located in the / var / www / html directory, and there is also a nginx welcome file.
I deleted it and now "403 Forbidden nginx / 1.6.2".
Here is the config:

server { listen *:80; server_name html; #ВАШ_ДОМЕН # Перенаправление на back-end location / { proxy_pass http://127.0.0.1:81; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_connect_timeout 120; proxy_send_timeout 120; proxy_read_timeout 180; } # Статическиое наполнение отдает сам nginx # back-end этим заниматься не должен location ~* \.(jpg|jpeg|gif|png|ico|css|bmp|swf|js|html|txt)$ { root /var/www/html; #ПУТЬ_ДО_КОРНЕВОГО_КАТАЛОГА_САЙТА } } 

I deploy locally, but access is needed remotely. Here is the address - http://sgus.ddns.net:61840/ Port 61840 is forwarded on the 80th.

Reads only .html files

  • Please do not forget to mark the answer;) - Stanislav Hmelevsky
  • Are you deploying locally, or on a remote VPS? - Stanislav Hmelevsky
  • The issue is still not resolved. - Sergey
  • Sergey, can you answer me a comment? Are you deploying locally or on a remote VPS? - Stanislav Hmelevsky
  • I deploy locally, but access is needed remotely. Here is the address - sgus.ddns.net:61840 Port 61840 is forwarded on the 80th. I did not have the opportunity to respond to comments, so the answer was placed by editing my question ... - Sergey

1 answer 1

Greetings
Nginx - gives statics.
Apache - dynamics.

The fact that you see the welcome page of Nginx is quite logical, since you did not configure proxying requests from Nginx to Apache

Suppose that the name of your site my-site.ru

In the /etc/nginx/sites-available directory create a file my-site.conf
This is a configuration file for your future site. Inside, put the following code:

 server { listen *:80; server_name my-site.ru; #ВАШ_ДОМЕН # Перенаправление на back-end location / { proxy_pass http://127.0.0.1:81; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_connect_timeout 120; proxy_send_timeout 120; proxy_read_timeout 180; } # Статическиое наполнение отдает сам nginx # back-end этим заниматься не должен location ~* \.(jpg|jpeg|gif|png|ico|css|bmp|swf|js|html|txt)$ { root /var/www/папка_проекта; #ПУТЬ_ДО_КОРНЕВОГО_КАТАЛОГА_САЙТА } } 

After that, you need to create a symbolic link in the folder sites-enabled
Running the command:
ln -s /etc/nginx/sites-available/my-site.conf /etc/nginx/sites-enabled/my-site.conf

Do not forget to check the nginx.conf file that is located in /etc/nginx/nginx.conf for the presence of the include /etc/nginx/sites-enabled/*; command at the end include /etc/nginx/sites-enabled/*;

After all of the above, run the command: sudo service nginx restart , if everything is done correctly, then nginx will restart and everything will be ok. :)

PS You can skip symbolic link manipulations if you immediately create the file my-site.conf in the /etc/nginx/conf.d/ directory

PPS From myself I will add, if the project is new, I recommend looking towards PHP7 and PHP7-FPM for the Apache location, since It works much faster. And generally towards PHP-FPM even if PHP7 for some reason does not fit.