ServerAdminwebmaster@yourdomain.comDocumentRoot/var/www/htmlErrorLog${APACHE_LOG_DIR}/error.logCustomLog${APACHE_LOG_DIR}/access.logcombinedOptionsIndexesFollowSymLinksAllowOverrideAllRequireallgranted
配置文件内容示例:
server{listen80;server_nameyourdomain.com;root/var/www/html;indexindex.phpindex.htmlindex.htm;location/{try_files$uri$uri/=404;}location~\.php${includesnippets/fastcgi-php.conf;fastcgi_passunix:/var/run/php/php7.4-fpm.sock;}location~/\.ht{denyall;}}
对于Apache,编辑/etc/apache2/sites-available/000-default.conf文件。
错误日志
查看Web服务器和PHP的错误日志,以发现并解决潜在问题。常见的日志文件路径如下:
Nginx:/var/log/nginx/error.log
Apache:/var/log/apache2/error.log
PHP:/var/log/php7.4-fpm.log
使用以下命令创建数据库和用户:
sudomysql-uroot-pCREATEDATABASEwebsitedb;CREATEUSER'websiteuser'@'localhost'IDENTIFIEDBY'password';GRANTALLPRIVILEGESONwebsitedb.*TO'websiteuser'@'localhost';FLUSHPRIVILEGES;EXIT;
ServerAdminwebmaster@yourdomain.comDocumentRoot/var/www/htmlErrorLog${APACHE_LOG_DIR}/error.logCustomLog${APACHE_LOG_DIR}/access.logcombinedOptionsIndexesFollowSymLinksAllowOverrideAllRequireallgranted
配置文件内容示例:
server{listen80;server_nameyourdomain.com;root/var/www/html;indexindex.phpindex.htmlindex.htm;location/{try_files$uri$uri/=404;}location~\.php${includesnippets/fastcgi-php.conf;fastcgi_passunix:/var/run/php/php7.4-fpm.sock;}location~/\.ht{denyall;}}
对于Apache,编辑/etc/apache2/sites-available/000-default.conf文件。
校对:唐婉(f3J1ePQDlzHhwh44q38w4Ima2E3XrDq)


