i tried to open https://isin.ir/wp-admin/theme-editor.php and customize my theme
i get error
Request Timeout
This request takes too long to process, it is timed out by the server. If it should not be timed out, please contact administrator of this web site to increase 'Connection Timeout'.
the thing i did
increase max_execution_time in php.ini
add define( 'DISALLOW_FILE_EDIT', false ); to wp-config.php
when i chang theme this problem was solved
hi in my opinion if you use this code your problem fix
server {
listen 4050;
listen [::]:4050;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/deltatechco.ir;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name deltatechco.ir www.deltatechco.ir;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
Related
I seem to have hit a problem. I had a live website, and decided to change the domain name, this involved removing the old SSL and adding a new one in.
Server settings:
Ubuntu 20.4
Nginx(Latest version)
MariaDb
php-fpm
Wordpress
So the steps I taken to remove the ssl were the following:
cp -r /etc/letsencrypt/ /etc/letsencrypt.backup
certbot revoke --cert-path /etc/letsencypt/archive/healthwellnesssynergy.com/cert1.pem
certbot delete
sudo apt purge nginx nginx-common nginx-core
Then I re-installed Nginx, ran certbot installation, installed the ssl, restarted nginx, but when I go to my new domain, it is just a blank white page. I tried to debug it, but there is nothing in the logs.
When i enable WP debug, nothing happens. And wappalizer plugin does not even show Wordpress present in the list.
I am not really sure what I am missing, I checked all the statuses, and it is all running, mariadb and nginx are functioning as intended.
Are there any other steps I need to take when I switch SSL?
Here is my nginx config
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php;
server_name hwscenter.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$args;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/hwscenter.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/hwscenter.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
server {
if ($host = hwscenter.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name hwscenter.com;
return 404; # managed by Certbot
}
Silly me.. forgot to uncomment a line for the NginX Config.
include snippets/fastcgi-php.conf;
So after conducting a long research and not being able to find an answer to my problems, i’ve decided to ask for help.
I recently joined DigitalOcean as a client and created my first droplet, with the intention of migrating from another service.
It runs on Ubuntu 18.04, it has Nginx and PHP 7.2 installed.
I’ve been knocking my head trying to figure out why wouldn’t it run any php files in the /var/www/html folder, instead i get the “This site can’t be reached” for a simple phpinfo().
It runs html files just fine so it must have something to do with the php setup.
It almost always is something simple, this time however i cannot seem to find out what it is, would someone be able to help?
Here is my default config for nginx:
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
location ~ /\.ht {
deny all;
}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
And PHP seems to be running fine:
php7.2-fpm.service - The PHP 7.2 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.2-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2019-12-09 13:26:59 UTC; 30min ago
Docs: man:php-fpm7.2(8)
Main PID: 14842 (php-fpm7.2)
Status: "Processes active: 0, idle: 2, Requests: 2, slow: 0, Traffic: 0req/sec"
Tasks: 3 (limit: 4704)
CGroup: /system.slice/php7.2-fpm.service
├─14842 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf)
├─14866 php-fpm: pool www
└─14867 php-fpm: pool www
Dec 09 13:26:59 ubuntu-s-2vcpu-4gb-fra1-01 systemd[1]: Starting The PHP 7.2 FastCGI Process Manager...
Dec 09 13:26:59 ubuntu-s-2vcpu-4gb-fra1-01 systemd[1]: Started The PHP 7.2 FastCGI Process Manager.
I'm trying to make a local webserver with nginx php 7.1 and mariadb on windows WSL.
I tried a lot of things, use Kali, use Debian, use Ubuntu, change nginx port instead of 80, I found a few nginx config that I tried but none worked.
My problem is that php don't process throught nginx.
When I try to load a simple php page <?php echo 'ok'; ?> it load infinitly.
But when I restart php7.1-fpm, the page work ! (One time and only if I was trying to load it)
This is my actual default nginx config file :
server {
listen 32000 default_server;
listen [::]:32000 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
# # With php-cgi (or other tcp sockets):
#fastcgi_pass 127.0.0.1:9000;
# I tried this too :
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
#fastcgi_pass 127.0.0.1:9000;
#fastcgi_index index.php;
#include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
When I run php index.php this is working too. But on firefox nothing happen when I load this file. Everything is fine with full html page. I got the nginx welcome page too with no problems.
I don't know where to look anymore. Thanks for reading and if you have any answer, thanks a lot !
Here is mine:
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9123;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME D:/web/html$fastcgi_script_name;
include fastcgi_params;
try_files = $uri #missing;
}
Also make sure PHP-CGI is running (and on the right port).
when i add another nginx-php site,this site was redirected to another php site,i didn't write the redirect in .conf file. what happend?
this is my new site : y2b.casvot.com
site above was redirected to this domain : www.casvot.com
//=======================my nginx config file=================
//
//You should look at the following URL's in order to grasp a solid understanding
//of Nginx configuration files in order to fully unleash the power of Nginx.
//http://wiki.nginx.org/Pitfalls
//http://wiki.nginx.org/QuickStart
//http://wiki.nginx.org/Configuration
//Generally, you will want to move this file somewhere, and start with a clean
//file but keep this around for reference. Or just disable in sites-enabled.
// Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
// Default server configuration
//================================================
server {
// SSL configuration
//
// listen 443 ssl default_server;
//listen [::]:443 ssl default_server;
// Note: You should disable gzip for SSL traffic.
// See: https://bugs.debian.org/773332
// Read up on ssl_ciphers to ensure a secure configuration.
//See: https://bugs.debian.org/765782
//Self signed certs generated by the ssl-cert package
//Don't use them in a production server!
//include snippets/snakeoil.conf;
root /home/casvot;
//Add index.php to the list if you are using PHP
// Index file path
index index.php index.html index.htm index.nginx-debian.html;
server_name casvot.com www.casvot.com;
location / {
//First attempt to serve request as file, then
// as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
//pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root /home/casvot/;
include snippets/fastcgi-php.conf;
// With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
//SSL configuration
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.casvot.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.casvot.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
//Virtual Host configuration for example.com
//
// You can move that to a different file under sites-available/ and symlink that
//to sites-enabled/ to enable it.
server{
listen 80;
root /home/;
index index.php index.html index.htm ;
server_name y2b.casvot.com;
location / {
// First attempt to serve request as file, then
// as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location ~ \.php$ {
root /home;
include snippets/fastcgi-php.conf;
// With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
server {
if ($host = www.casvot.com) {
return 301 https://$host$request_uri;
} //managed by Certbot
if ($host = casvot.com) {
return 301 https://$host$request_uri;
} // managed by Certbot
listen 80 default_server;
listen [::]:80 default_server;
server_name casvot.com www.casvot.com;
return 404; //# managed by Certbot
}
/home directory:
An issue doesn't stick out at me, but is it possible that your server and your ISP support IPv6? Maybe it's connecting via IPv6 and www.casvot.com is the only vhost listening. I don't see a listen [::]:80; for y2b.casvot.com, but I see it for the other.
I've successfully installed nginx that uses PHP-FPM but unfortunately I'm having some trouble when loading my php files from a different directory. All my files are located in subdirectories in /var/www/html (e.g. all css-files are located in /var/www/html/css, all javascript-files are located in /var/www/html/js, all php-files are located in /var/www/html/php).
According to this, I changed the root directory path for my php files to /var/www/html/php:
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.php home.php;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /var/www/html/php;
include snippets/fastcgi-php.conf;
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
Unfortunately, when accessing my nginx server using my web browser, I'm getting error 403 (Forbidden). When accessing my index.php (http://192.168.2.109/index.php) directly, everything works fine. So, I think it means that the file permissions are correct but nginx isn't able to index the /var/www/html/php directory. Furthermore, /var/log/nginx/error.log includes:
2017/05/28 07:49:56 [error] 13678#13678: *1 directory index of "/var/www/html/" is forbidden, client: 192.168.2.101, server: _, request: "GET / HTTP/1.1", host: "192.168.2.109"
I already tried to enable autoindex and add the index specifier in the "location ~ .php$ {" section without success. The result is the same :(
Does anyone has an idea what I'm doing wrong/missing here? All suggestions in Nginx 403 error: directory index of [folder] is forbidden didn't solve my problem.
The problem are easy:
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /var/www/html/php;
include snippets/fastcgi-php.conf;
# # With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
As I can read, when you request a *.php file, you change the root address. But, when you request "default index", you are requesting /, not a .php
You need a new location, for change root path on / request. Try to use this:
location = / {
root /var/www/html/php;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
Maybe, on this config, you need to put a "rewrite index.php;", but I didn't know because I've never test this configuration.
Don't think my new location order (location = /) is the same as yours (location /), because my order, with the equal sign, only apply when you request exactly the "main" location without any parameter.