完成本地转线上部署后,无法访问WordPress网站及后台
Hey Ashutosh, let’s work through why your migrated WordPress site isn’t accessible online—this is a super common snag, so we’ll break it down step by step:
1. Confirm DNS Propagation First
Start with the basics: make sure your domain notesbank.in is pointing to your new online server’s IP. DNS changes can take 24-48 hours to roll out globally, so check it by running these commands in your local terminal:
nslookup notesbank.in # OR dig notesbank.in
If the output shows your old local server’s IP instead of the new one, either wait for propagation or double-check your DNS settings with your domain registrar.
2. Check Server Firewall & Port Access
Most online servers lock down incoming traffic by default. Ensure:
- Port 80 (HTTP) and Port 443 (HTTPS) are open in your server’s firewall (like UFW on Ubuntu, or security groups for cloud providers).
- Your hosting provider hasn’t flagged your domain/IP for restrictions—check their dashboard for any alerts.
3. Double-Check WordPress Database Settings
You updated wp_options, but let’s verify no details slipped through:
- Log into your online server’s database (via phpMyAdmin or
mysqlcommand line) and navigate to thewp_optionstable. - Confirm both
siteurlandhomeare set tohttps://notesbank.in(orhttp://if you haven’t set up SSL yet—pro tip: grab a free Let’s Encrypt cert ASAP). - Hunt for hardcoded old URLs in theme/plugin files using this server command (replace
old-local-urlwith your local server address likehttp://localhost):
Update any matches you find togrep -r "old-local-url" /path/to/your/wordpress/rootnotesbank.in.
4. Validate wp-config.php Tweaks
You adjusted this file, but let’s make sure these critical lines are correct:
define('WP_HOME', 'https://notesbank.in'); define('WP_SITEURL', 'https://notesbank.in'); define('WP_DEBUG', true); // Turn this on temporarily to see error messages
Enabling WP_DEBUG will show you PHP errors that might be breaking the site—just remember to disable it once you fix the issue!
5. Wipe All Caches
Caching is often the hidden culprit:
- If you used a caching plugin locally (like WP Rocket), delete the
wp-content/cache/folder on your online server. - Restart your web server to clear server-side caches (OPcache/APCu):
# For Apache sudo systemctl restart apache2 # For Nginx sudo systemctl restart nginx - Clear your local browser cache completely (Ctrl+Shift+Delete) or test the site in incognito mode.
6. Check Web Server Configuration (Apache/Nginx)
Make sure your web server is serving WordPress correctly:
For Apache
Ensure your virtual host points to the right document root and has rewrite rules enabled:
<VirtualHost *:80> ServerName notesbank.in ServerAlias www.notesbank.in DocumentRoot /var/www/notesbank.in/public_html <Directory /var/www/notesbank.in/public_html> AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/notesbank.in-error.log CustomLog ${APACHE_LOG_DIR}/notesbank.in-access.log combined </VirtualHost>
Enable rewrite rules with sudo a2enmod rewrite then restart Apache.
For Nginx
Your server block needs WordPress-friendly rewrite rules:
server { listen 80; server_name notesbank.in www.notesbank.in; root /var/www/notesbank.in/public_html; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php8.1-fpm.sock; # Adjust your PHP version here } }
Test the config with sudo nginx -t before restarting.
7. Verify SSL Certificate (If Using HTTPS)
If you’re trying to access via https://, make sure your SSL cert is installed correctly. Use certbot to get a free Let’s Encrypt cert if you haven’t already—invalid/missing certs will block browser access.
If you still can’t reach the site or wp-admin after these steps, share the error messages from WP_DEBUG or your browser console, and we’ll dig deeper!
内容的提问来源于stack exchange,提问作者Ashutosh Gupta

