我正在尝试使用Nginx和Cloud SQL在Compute Engine中建立一个WordPress网站。我已经使用Ubuntu 18.0设置了一个实例,并使用以下命令安装了Nginx和WordPress:
- $ sudo apt更新
- $ sudo apt install nginx
- sudo apt-get install php-fpm php-mysql
- sudo nano /etc/php/7.2/fpm/php.ini
- 并在
cgi.fix_pathinfo=0
中更改php.ini
- sudo systemctl重新启动php7.2-fpm
- sudo nano / etc / nginx / sites-available / default
并设置如下:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name COMPUTE_ENGINE_INSTANCE_STATIC_IP;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
- sudo nginx -t并返回
success
消息。
- sudo systemctl重新加载nginx
- sudo apt-get install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc
- sudo systemctl重新启动php7.2-fpm
- cd / tmp
- 卷曲-O https://wordpress.org/latest.tar.gz
- tar xzvf Latest.tar.gz
- cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
- mkdir / tmp / wordpress / wp-content / upgrade
- sudo cp -a / tmp / wordpress /。 / var / www / html
- sudo adduser根www-data
- sudo chown -R kimseasok:www-data / var / www / html
- sudo chmod -R g + rwX / var / www / html
现在,当我尝试访问实例IP时,它将返回此错误:
502错误的网关
nginx / 1.14.0(Ubuntu)
这是怎么了?
请帮帮我!
谢谢!